| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 67 | 48 | 36 | 72.000% |
Today is the Age of Agriculture.
As a member of Japan Agriculture Group (JAG), you grow $N$ kinds of plants this year. Each plant has different harvest seasons: the $i$-th plant must be gathered at some day between $s_i$ and $t_i,ドル inclusive.
You plan to gather plants $K$ times, where the $j$-th gathering day is $h_j$. On the $j$-th gethering day, if the $i$-th plant has not been gathered yet and the gathering day is within the harvest season of the $i$-th plant, that is $s_i \le h_j \le t_i,ドル you have to gather the $i$-th plant.
You are not sure whether your planned days are sufficient to gather all the $N$ plants. If not, you would not be able to survive this cruel Age of Agriculture. Thus you decided to write a program to compute the number of plants gathered after $K$ gathering days you planned.
The input consists of a single test case of the following format.
$N$
$s_1$ $t_1$
$\vdots$
$s_N$ $t_N$
$K$
$h_1$
$\vdots$
$h_K$
The first line is the number $N$ of plants you will grow (1ドル \le N \le 10^5$). The $i$-th of the following $N$ lines consists of two integers $s_i$ and $t_i,ドル which represent that the harvest season of the $i$-th plant is $[s_i,t_i]$ (1ドル \le s_i \le t_i \le 10^9$).
The following line contains the number $K$ of the gathering days you plan (1ドル \le K \le 10^5$). The j-th of the following $K$ lines contains an integer $h_j$ (1ドル \le h_j \le 10^9$), which is the $j$-th gathering day you plan. You can assume that holds $h_j < h_{j+1}$ for 1ドル \le j \le K-1$.
Print the number of plants gathered after your planned gathering days.
4 1 2 3 3 2 4 7 9 2 3 9
3
4 1 5 5 10 3 8 5 5 1 5
4