eolymp
bolt
Try our new interface for solving problems
Problems

Matches for children are not toys!

Matches for children are not toys!

Vasya loves to solve puzzles with matches. Most often they are formulated as follows: the image A is made up of matches; shift the minimum number of matches in it so that to get the image B.

For example, from the number of the current team championship of schoolchildren in St. Petersburg on programming, you can get a rhombus with a diagonal by shifting just three matches.

prb2222

The puzzles that Vasya solves always have a solution. This means that the set of matches used in the image A matches the set of matches used in the image B. In addition, in one image, two matches that have a common section of nonzero length never occur (that is, matches can intersect, but cannot overlap).

Vasya is tired of solving puzzles manually, and now he asks you to write a program that will solve puzzles for him. The program will receive the descriptions of images A and B and should find the minimum number of matches that need to be shifted in the image A so that the resulting picture is obtained from B by parallel transfer.

Input

The first line contains the number of matches n (1n1000) in each of the images.

The following n lines contain the coordinates of the ends of the matches in the image A. Match number i is described by the integers x1i, y1i, x2i, y2i - the coordinates of its ends. The following n lines contain a description of the image B in the same format. The set of lengths of these matches matches the set of lengths of matches from the image A.

All coordinates do not exceed 104 by in absolute value. All matches have a non-zero length, i.e. x1ix2i or y1iy2i.

Output

Print the minimum number of matches to be shifted so that the image A coincides with the image B up to parallel transfer.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5
0 0 1 2
1 0 0 2
2 0 2 2
4 0 3 2
4 0 5 2
9 -1 10 1
10 1 9 3
8 1 10 1
8 1 9 -1
8 1 9 3
Output example #1
3
Source 2006, XIV St. Petersburg School Programming Team Championship, November 6, Problem F