Post office
We have n rectangular postcards, each with dimensions x[i]
and y[i]
for i = 1 to n. There are also two types of postal envelopes available in unlimited quantities: one with dimensions a × b and the other with dimensions c × d. Each envelope can hold only one postcard, and the postcard must be placed such that its sides are parallel to the sides of the envelope and do not exceed the envelope's dimensions.
What is the maximum number of postcards that can be placed into the envelopes?
Input
The first line contains the integers n, a, b, c, d. The following n lines each contain two integers, x[i]
and y[i]
, representing the dimensions of each postcard. All values are natural numbers and do not exceed 100.
Output
Output the maximum number of postcards that can be placed into the envelopes.