#abc218d. [abc218_d]Rectangles
[abc218_d]Rectangles
Problem Statement
We have distinct points on a two-dimensional plane, numbered . Point has the coordinates .
How many rectangles are there whose vertices are among the given points and whose edges are parallel to the - or -axis?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
6
0 0
0 1
1 0
1 1
2 0
2 1
Sample Output 1
3
There are three such rectangles:
the rectangle whose vertices are Points , , , ,
the rectangle whose vertices are Points , , , ,
and the rectangle whose vertices are Points , , , .
Sample Input 2
4
0 1
1 2
2 3
3 4
Sample Output 2
0
Sample Input 3
7
0 1
1 0
2 0
2 1
2 2
3 0
3 2
Sample Output 3
1