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:
- Its vertices are black points on the painting.
- It's an iscosceles and right triangle at the same time.
- 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 trianglesConstraints
1 ≤ N ≤ 100 000The coordinates of the points are integer numbers smaller than 109+1
Sample
Input | Output |
---|---|
7 0 0 1 0 2 0 1 1 2 1 1 2 2 2 | 10 |