beecrowd | 1378
# Isosceles Triangles

**Timelimit: 6**

By Pablo Heiber Argentina

A given triangle can be either equilateral (three sides of the same length), scalene (three sides of different lengths), or isosceles (two sides of the same length and a third side of a different length). It is a known fact that points with all integer coordinates cannot be the vertices of an equilateral triangle.

It's given to you a set of different points with integer coordinates on the XY plane, such that no three points in the set lay on the same line. Your job is to calculate how many of the possible choices of three points are the vertices of an isosceles triangle.

There are several test cases. Each test case is given in several lines. The first line of each test case contains an integer **N** indicating the number of points in the set (3 ≤ **N** ≤ 1000). Each of the next **N** lines describes a different point of the set using two integers **X** and **Y** separated by a single space (1 ≤ **X**, **Y** ≤ 10^{6} ); these values represent the coordinates of the point on the XY plane. You may assume that within each test case no two points have the same location and no three points are collinear.

The last test case is followed by a line containing a single zero.

For each test case output a single line with a single integer indicating the number of subsets of three points that are the vertices of an isosceles triangle.

Sample Input | Sample Output |

5 |
4 |