시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB77533767.273%

문제

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.

예제 입력 1

4
1 2
3 3
2 4
7 9
2
3
9

예제 출력 1

3

예제 입력 2

4
1 5
5 10
3 8
5 5
1
5

예제 출력 2

4