#P1665. 正方形计数

正方形计数

Description

Given NN points on a plane, you need to count the number of squares whose vertices are among these points. Note that the square’s sides do not need to be parallel to the coordinate axes.

Input Format

The first line contains an integer NN.

Each of the next NN lines contains two numbers, representing the coordinates of a point.

Output Format

Output a single number, the number of squares.

7
0 0
0 1
1 0
1 1
1 2
2 1
2 2
3

Hint

For 20%20\% of the testdata, 1N201 \leq N \leq 20.

For 100%100\% of the testdata, 1N5001 \leq N \leq 500, 50Xi,Yi50-50 \leq X_i, Y_i \leq 50, and the points are distinct.

Translated by ChatGPT 5