Rectangles online
Vasya has plotted N distinct points on a plane, each with integer coordinates.
He now needs a fast way to determine how many of these points fall within a specified rectangle, where the rectangle's sides are parallel to the coordinate axes.
Input
The first line provides the number of points N (1 ≤ N ≤ 50000). The next N lines list the coordinates of these points as x_i y_i. Following this, a line indicates the number of queries M (1 ≤ M ≤ 50000). Each of the next M lines describes a query in the format x_1, y_1, x_2, y_2 (0 ≤ x_1 ≤ x_2 ≤ 10^9, 0 ≤ y_1 ≤ y_2 ≤ 10^9). For each query, you must:
Count the number of points located within the specified rectangle, including those on the boundary.
Remove all points that were counted.
Output
For each query, output the number of points counted.