Geysers
The valley where Manny, Sid and Diego live can be represented as a two-dimensional plane. We introduce coordinate axes on this plane. The OX axis is horizontal and directed from west to east, the OY axis is vertical and directed from south to north. There are n geysers on this plane, each geyser is a point. Using the data about the location of geysers, friends want to assess how unstable the seismic situation in their valley is.
We call a triple of geysers bad if the triangle which vertices are geysers satisfies all of the following properties:
it is non-degenerate
rectangular,
isosceles,
at least one of its sides is parallel to OX or OY,
there are no other geysers on the sides of the triangle, except for three that lie at the vertices.
Friends believe that the more bad triplets of geysers, the more unstable the seismic situation. Help them count the number of bad triplets. Two triples are considered different if there is a geyser that is included in one triple and not included in the other.
Input
The first line contains one integer n (1 ≤ n ≤ 10^5
) - the number of geysers.
Each of the next n lines contains two integers x[i]
and y[i]
(|x[i]
|, |y[i]
| ≤ 10^6
) - coordinates of the point where the i-th geyser is located. It is guaranteed that no two geysers are located at the same point.
Output
Print one integer - the number of bad triplets of geysers.