시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 256 MB 1 1 1 100.000%

문제

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.

예제 입력

3
0 0
1 0
0 1

예제 출력

1

예제 입력 2

4
0 0
1 0
0 1
1 1

예제 출력 2

4

힌트