A fleet of fishing boats set sail on the open sea from an Adriatic island. The position of each fishing boat is described with a point in the standard coordinate system, whereas the island is described with a convex polygon. The boats communicate via radio devices, and the island represents an obstacle for the radio waves. More precisely, if boat transmits a message, then boat receives the message if and only if the line segment connecting the positions of and does not cross the interior of the island (it is allowed to have the line segment touch the sides and vertices of the island).
When ship gets in trouble, it transmits the so-called Mayday message asking for help. All ships that receive the Mayday message immediately send the so-called Relay message repeating that ship needs help. If a ship only receives the Relay message (and not the original Mayday message), then it sends nothing.
You are given the positions of ships denoted with integers from to and the location of the island. Ship number has found itself in trouble and sends the Mayday message. Determine the total number of ships that will receive either the original Mayday message or any of the Relay messages.
Input Specification
The first line of input contains the integer – the number of ships. The of the following lines contains two integers and – the coordinates of the ship. All ships are located on different coordinates, not a single ship is located on a side or inside the polygon.
The following line contains the integer – the number of vertices of the convex polygon describing the island. The of the following lines contains two integers and – the coordinates of the vertex of the polygon. The polygon's vertices are given in the counter-clockwise direction and form a convex polygon. No two adjacent edges will be parallel.
Output Specification
You must output the required total number of boats that will receive one of the messages.
Constraints
Subtask | Score | Constraints |
---|---|---|
, | ||
, | ||
, | ||
, |
Sample Input 1
9
9 6
8 5
10 8
8 8
-2 3
-1 5
9 1
0 1
-1 2
7
1 1
5 1
8 3
7 5
4 6
0 5
-1 3
Sample Output 1
6
Sample Input 2
4
-1 0
-3 -20
6 10
5 10
4
3 0
3 1
0 10
0 -10
Sample Output 2
2
Comments