Criss-Cross

아직 제출이 없습니다시간 제한10초메모리 제한1024 MB

문제

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 nn (1n1,0001 \le n \le 1\\,000) which is the number of lines.  The following nn lines contain four integers x_0   y_0  x_1   y_1x\_0 \ \  y\_0 \ \ x\_1 \ \  y\_1 (1,000,000x_0, y_0, x_1, y_11,000,000-1\\,000\\,000 \le x\_0, \ y\_0, \ x\_1, \ y\_1 \le 1\\,000\\,000. Lines have non-zero length, i.e., the two points will be distinct: x_0x_1x\_0 \ne x\_1 or y_0y_1y\_0 \ne 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.