Peter is bored during his operating systems class, so he draws doodles on a sheet of paper. He feels like drawing abstract art using his ruler: he draws line segments by choosing two points in the plane and connecting them. Lots of them.
Can you write a program that counts the number of distinct points at which the line segments he drew intersect or touch?
The first line in the input contains an integer n (1≤n≤1,000) which is the number of lines. The following n lines contain four integers x_0 y_0 x_1 y_1 (−1,000,000≤x_0, y_0, x_1, y_1≤1,000,000. Lines have non-zero length, i.e., the two points will be distinct: x_0=x_1 or y_0=y_1 or both.
Output the number of distinct points for which there is at least one pair of line segments that intersects or touches at this point.
Ignore those intersections points in your count that are created by line segments that intersect or touch at more than one point (i.e. overlapping segments).
You may further assume that if two line segments touch exactly at their endpoints, the three points involved are not collinear.