Watchmen
InterviewTime limit2sMemory limit1024 MB
Count pairs of points whose Manhattan distance equals their Euclidean distance, given n points with integer coordinates.
Statement
Watchmen are in danger, so Doctor Manhattan and his friend Daniel Dreiberg must warn them as soon as possible. There are watchmen on a plane, and the -th watchman is located at point .
Doctor Manhattan measures the distance between watchmen and as . Daniel, an ordinary person, calculates the distance as .
The success of the operation depends on the number of pairs () for which the distance computed by Doctor Manhattan equals the distance computed by Daniel. Count these pairs.
Input
The first line contains a single integer (), the number of watchmen.
Each of the next lines contains two integers and ().
Output
Print the number of pairs of watchmen whose Manhattan distance equals their Euclidean distance.
Hint
In the first sample, the distance between watchmen 1 and 2 is for Doctor Manhattan and for Daniel. For the pairs , , , and , Doctor Manhattan and Daniel calculate the same distance.