Each to Their Own Square
InterviewTime limit3sMemory limit1024 MB
For each test case, count the squares whose four corners are all among the given n points, stopping when n is 0.
Problem
Ana and Bob enjoy playing with geometry. Last week, while listening to a song about squares, Bob was playing with his wooden blocks and wondered how many squares could be formed using the blocks as vertices, without moving them. Ana had recently learned to program and came up with the idea of writing a program to solve this problem. However, she struggled with it and asked for your help. Since the blocks are small compared to the distances between them, you may treat them as points on a plane.
Input
The input contains multiple test cases. Each test case begins with a line containing a single integer , where . The next lines each contain two integers and , the coordinates of a block, where . The input ends with a line containing , which should not be processed.
Output
For each test case, print one line containing a single integer, the number of squares that can be obtained from the given positions.