circ-bear-and-vectors

Limak is a little polar bear, who isn't afraid of geometry.
He has n 2-dimensional non-zero vectors \vec{a_1}, \vec{a_2}, \ldots, \vec{a_n}, each described by two integers x_i, y_i.
Show him that you can count ways to choose an ordered triple of distinct indices i, j, k satisfying the two conditions:
\vec{a_i} is perpendicular to \vec{a_j} + \vec{a_k}
\vec{a_j}+\vec{a_k} \ne 0

If you don't know vectors (so you don't understand what is written above) then you can use the following three conditions, equivalent to those given above:
For fixed i, j, k let A, B, S denote points (x_i, y_i), (x_j + x_k, y_j + y_k), (0, 0) respectively.
\measuredangle ASB = 90^{\circ}
B \ne S

Input format
The first line contains one integer n — the number of vectors.

The i-th of next n lines contains two integers x_i, y_i — coordinates of \vec{a_i}.

Some of n vectors may be equal to each other but none of them is equal to \vec{(0, 0)}.

Output format
In one line print the number of ordered triples of distinct indices i, j, k satisfying the given conditions.

Constraints

3 ≤ n ≤ 3000
|x_i|, |y_i| ≤ 10^9

SAMPLE INPUT
5
1 1
1 0
2 -1
-2 1
1 0

SAMPLE OUTPUT
4

Explanation

There are n = 5 vectors in the sample test.
Note that some of them may be equal.
There are 4 ways to choose a triple of indices:
(1, 2, 4) because \vec{a_1} = \vec{(1, 1)} is perpendicular to \vec{a_2} + \vec{a_4} = \vec{(1-2, 0+1)} = \vec{(-1, 1)}
(1, 4, 2)
(1, 4, 5)
(1, 5, 4)

Source: hackerearth | Difficulty: MEDIUM_HARD


Solutions: