|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||6||3||3||50.000%|
In popular operating system we opened lots of windows.
Each window is rectangle consisting of small squares (of dimension 1 x 1).
Newly opened windows, depending of its position and size, can (partially or totally) cover some earlier opened windows.
We can close window with mouse if we click on its upper right small square, which in that moment must be visible. Square of some window is visible if there is no later opened window, which is not yet closed.
Write the program that will calculate the minimal number of mouse clicks to close the window that we opened first.
In first line of input file there is integer N, number of windows, 1 ≤ N ≤ 100.
In each of the next N lines there are 4 integers R1, S1, R2 and S2, separated with spaces, 1 ≤ R1 ≤ R2 ≤ 10000, 1 ≤ S1 ≤ S2 ≤ 10000. Numbers R1 and S1 stand for row and column of the screen in which is upper-left square of that window, and R2 and S2 stand for row and column of the screen in which is lower-right square of that windows. Windows are opened in the same order like they appears in the input file.
We imagine screen as it consits of rows and columns of small squares. Rows are numerated from the top to the bottom, columns from the left to the right, and upper-left square on the screen is in the first row and first column.
In first and only line of output file you should write the minimal number of mouse clicks.
3 3 1 6 4 1 2 4 6 2 3 5 5
3 4 1 6 3 2 2 5 5 1 4 3 6
3 3 3 4 4 1 1 2 2 5 5 6 6