시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB33272385.185%

문제

Zhomart likes watching the stars and construct a variety of geometric shapes from them. The sky is represented in the form of the Cartesian coordinate system, and the stars are represented by points on it. At this moment Zhomart interested in the question: how many different right triangles whose legs are parallel to the axes, you can create with the help of stars in the sky.

입력

In the first line of the input line you are given N –– the number of stars on the sky (3 ≤ N ≤ 300000). Each of the next N lines contains integer X and Y (|X, Y| ≤ 109) –– coordinates of the appropriate star.

출력

Print one number – the answer to the question.

예제 입력 1

3
0 0
1 0
0 1

예제 출력 1

1

예제 입력 2

4
0 0
1 0
0 1
1 1

예제 출력 2

4