
96  ZOJ Monthly, September 2010  E
Suffered from the economic crisis, the government has a great deficit, so they decide to exploit a treasure area. In this area, each lattice point has one unit of treasure, and the government plans to build up N tunnels, which will start from one lattice point and end at another lattice point. As the tunnel pass a lattice point, that unit of treasure will be obtained by the government. Unfortunately, because of the poor plan, the tunnels may overlap or intersect with each other. However, even if multiple tunnels intersect at a grid point, the government can get only 1 unit of treasure at each of these intersections. According to the plan, the government wants to know how much treasure they can get in advance. InputThere're multiple test cases (no more than 20). The first line of each test case contains an integer N (1 <= N <= 1000), indicating the number of tunnels. The following N lines contain four integer x_{1}, y_{1}, x_{2} and y_{2}(x_{1}  x_{2} + y_{1}  y_{2} > 0), represents the starting and ending points of the i^{th} tunnel. The absolute value of x_{1}, y_{1}, x_{2} and y_{2} will no larger than 1000000. OutputOutput the quantity of the treasure the government will get.Sample Input6 0 0 2 4 0 0 4 2 2 0 2 4 3 0 0 3 2 4 5 5 4 2 5 5 Sample Output11 HintThe chart of the sample: Author: OUYANG,Jialin Contest: ZOJ Monthly, September 2010 