Leaf in the cage
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
On a square piece of paper the size of N×N cells K drew different rectangles with the sides on the lines of the grid. Knowing the coordinates of pairs of opposite vertices of each rectangle in the rectangular coordinate system whose origin lezhit in one of the extreme points of the leaf, and the axes coincide with its sides, calculate how many pieces fall apart a piece of paper, if you make the cuts on each side of the rectangle.
Input
In the first runoff of N and K. The following K lines of four non-negative integers - the coordinates of two opposite vertices of each rectangle. All numeric values are non-negative integers, not greater than 100.
Output
The answer to the problem.
Examples
Input #1
Answer #1
Submissions 559
Acceptance rate 11%