cho.sh
Notes
Loading...

Rectangles

Time limit

2s

Memory limit

128 MB

Problem

There are N rectangles on a two-dimensional plane. Every side of each rectangle is parallel to one of the coordinate axes, and every vertex has natural-number coordinates. Rectangles may overlap, coincide exactly, or lie inside another rectangle.

Draw one line that passes through the origin (0, 0). A rectangle is considered intersected if the line meets its interior or boundary. Even if the line only touches one vertex of the rectangle, it is still considered an intersection.

Choose a line through the origin so that it intersects as many rectangles as possible, and find that maximum number.

Input

The first line contains the number of rectangles N (1 ≤ N ≤ 10,000). Each of the next N lines contains four integers xbl, ybl, xtr, and ytr: the coordinates of the lower-left vertex and the upper-right vertex of a rectangle.

All coordinates are natural numbers not greater than 1,000,000,000, and they satisfy xbl < xtr and ybl < ytr.

Output

Print the maximum number of rectangles that can be intersected by one line through the origin.