A square is a four-sided polygon whose sides all have equal length and whose adjacent sides meet at 90-degree angles. Equivalently, it is a polygon that looks exactly the same after being rotated 90 degrees about its centre. This rotation property alone does not single out the square, however: a regular octagon also looks the same after a 90-degree rotation.
Given a set of stars in the night sky, count how many squares can be formed using the stars as corners. To keep things simple, treat the night sky as a two-dimensional plane where each star is given by integer coordinates $(x, y)$. The squares may be axis-aligned or tilted at any angle.
The input consists of several test cases. Each test case begins with a line containing the integer $n$ ($1 \le n \le 1000$), the number of points. Each of the next $n$ lines contains the $x$ and $y$ coordinates (two integers) of one point. All points are distinct, and the absolute value of every coordinate is at most $20000$. A line with $n = 0$ terminates the input.
For each test case, print on its own line the number of squares that can be formed from the given stars.