Under construction

Still being built. Things may change

Nabiya Nabiya

Time limit2sMemory limit1024 MB

Summary
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 NN points on a two-dimensional sheet of paper. Then he picks 4 distinct points from them in order. Call these points A,B,C,DA, B, C, D. Seongwoo draws AB‾,BC‾,CD‾,DA‾\overline{\rm AB}, \overline{\rm BC}, \overline{\rm CD}, \overline{\rm DA}. 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 aa and bb are the same:

  • The set of segments belonging to butterfly aa is identical to the set of segments belonging to butterfly bb.

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 NN. (4≤N≤2 000)(4 \leq N \leq 2\ 000)

The next NN lines each contain the coordinates of one point. For each integer ii with 1≤i≤N1 \leq i \leq N, the two integers xi,yix_i, y_i on line i+1i+1 are the coordinates of the ii-th point, separated by a space. (−1 000 000≤xi,yi≤1 000 000)(-1\ 000\ 000 \leq x_i, y_i \leq 1\ 000\ 000)

Output

Print the number of distinct butterflies Seongwoo can draw.

Examples2

  1. Example 1

    Input
    4
    0 0
    0 1
    1 0
    1 1
    
    Expected output
    2
    
  2. Example 2

    Input
    5
    0 0
    1 0
    0 2
    2 1
    1 1
    
    Expected output
    6