Nabiya Nabiya
Time limit2sMemory limit1024 MB
Given N points with no three collinear, count the 4-point cycles whose two opposite sides cross, with each segment set counted once.
- Level
Medium6 of 10
- Topics
- Combinatorics, Geometry, Sorting
- Solved
- No attempts yet
Problem
Yonghan is afraid of insects. Seongwoo saw this and wants to help Yonghan stop being afraid of bugs. After some thought, Seongwoo decided to use the butterfly, a pretty insect, to help him.
First, Seongwoo marks points on a two-dimensional sheet of paper. Then he picks 4 distinct points from them in order. Call these points . Seongwoo draws . If two of these segments cross at a point that is not an endpoint of both, Seongwoo calls the figure a butterfly.
Seongwoo also defines when two butterflies and are the same:
- The set of segments belonging to butterfly is identical to the set of segments belonging to butterfly .
Seongwoo wonders how many distinct butterflies he can draw. Find that number for him.
No three of the points lie on a single line.
Input
The first line contains the number of points .
The next lines each contain the coordinates of one point. For each integer with , the two integers on line are the coordinates of the -th point, separated by a space.
Output
Print the number of distinct butterflies Seongwoo can draw.