LogiQuest

164. Points in Rectangle

EasyGeometry

A rectangle has corners (x1, y1) and (x2, y2) (sides parallel to the axes). Count how many of the given points lie inside or on its border.

Input format

Line 1: x1 y1 x2 y2 Line 2: n Next n lines: x y

Output format

The count.

Example 1

Input

0 0 4 3
4
1 1
4 3
5 1
-1 0

Output

2

Example 2

Input

2 2 0 0
2
1 1
3 3

Output

1

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 3 test cases, most of them hidden.

Loading the MyLoginn IDE…