Special Triangles

Special triangles

To show his love, XORin takes XORina to the museum. Suddenly he sees a painting containing a XOY system with N black lattice points drawn on it. Because he always likes asking people unpleasant questions, XORin asks the tour guide how many special triangles can be formed using the black points from the painting. Help the tour guide answer XORin questions.

A special triangle has the following characteristics:

  1. Its vertices are black points on the painting.
  2. It's an iscosceles and right triangle at the same time.
  3. His cathetis are parallel with the system's axes.

Input

The first line contains N, the number of black points from the painting. The next N lines contain the coordinates of the black points.

Output

Print the number of special triangles

Constraints

1 ≤ N ≤ 100 000
The coordinates of the points are integer numbers smaller than 109+1

Sample

InputOutput
7
0 0
1 0
2 0
1 1
2 1
1 2
2 2
10
Questions?

Sponsors Gold