You are given N distinct points on a coordinate plane.
Choose three points to form a right triangle. The two sides meeting at the right angle must each be parallel to one of the coordinate axes. In other words, only right triangles whose two non-hypotenuse sides are parallel to the x-axis or y-axis are counted.
Find the number of ways to choose three points that satisfy this condition. The order of the chosen points does not matter.
The first line contains the number of points N.
Each of the next N lines contains two integers X and Y, the coordinates of one point.
Print the number of right triangles that satisfy the condition.