Count Squares
Time limit1sMemory limit128 MB
Given up to 2000 distinct integer points, count how many squares have all four vertices among them, including tilted squares.
Problem
You are given a set of points with integer coordinates for . Count the number of squares whose four vertices are all among these points. A square may be tilted; its sides need not be parallel to the axes.
Input
The input starts with the integer , followed by pairs of integers . Values are separated by spaces or newlines.
Output
Output a single integer: the number of squares found.
Constraints
- , .
- All points in the input are distinct.