Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Game of Points

By subhashis_cse · Limits 1s, 512 MB

There are n points in the plane, the ith of which is labeled Pi and has coordinates (xi,yi).

We know that the formula of Euclidean distance ( https://en.wikipedia.org/wiki/Euclidean_distance ) of two points which is denoted fun(P,Q) = ((p1 - q1)^2 + (p2 - q2)^2)^(1/2)

Now find how many ordered quadruples of pairwise-distinct indices (p,q,r,s) are there such that fun(p,q)+fun(r,s) is equal to fun(q,r) +fun(p,s) ?

Double precision should be 1e-6 (EPS = 1e-6)

Input

The first line of input contains a single integer (4<=n<=250).

The next n lines of input each contain two space-separated integers (0<=xi,yi<=16).

Output

Print a single integer: the number of ordered quadruples which is satisfied the condition.

Sample

InputOutput
4
3 0
0 4
7 3
4 7
8

Explanation:

The eight quadruples are

(0,1,3,2),

(0,2,3,1),

(1,0,2,3),

(1,3,2,0),

(2,0,1,3),

(2,3,1,0) ,

(3,1,0,2) ,

(3,2,0,1)

    Discussion

    Statistics


    50% Solution Ratio

    Chakraborty14Earliest, 2M ago

    Takik_Fastest, 0.2s

    Chakraborty14Lightest, 131 kB

    nasibsuShortest, 1086B

    Submit

    Login to submit