Zhomart loves to watch the stars and create various geometric shapes from them. The sky is provided in the form of a Cartesian coordinate system, and the stars on it are points. This time, Zhomart is interested in the question of how many different right-angled triangles, whose legs are parallel to the coordinate axes, can be formed using stars in the sky.
Input file format
The first line specifies N — the number of stars in the sky (3 ≤ N ≤ 300000). Each of the next N lines contains integers X, Y (|X, Y| ≤ 10
9) — coordinates of the corresponding star.
Output file format
Output the answer to the problem.
Examples
# |
Input |
Output |
1 |
3
0 0
10
0 1
| 1 |
2 |
4
0 0
10
0 1
1 1
| 4 |