Back when he was little, Stefan used to look a lot at the sky during the night, hoping to see various kinds of stars and to imagine different kinds of lines which can be drawn amongst them. Looking back at his childhood, he realized that he can now use the computer to refine this process!
Therefore, he gives you the 2D map of the stars during one particular night, and he tells you that there were stars on the sky. Furthermore, he also tells you that he is interested in finding the number of parallel L-shaped paths he can find in the given star map.
A parallel L-shaped path is a sequence of three stars which form an L-shape and it is parallel to the coordinate axes. The L can have its sides rotated, as long as it still forms an L. Furthermore, the L can't be degenerated(i.e: a straight line).
Input data
The first line of the input contains , the number of stars.
The next line of the input contains the coordinates of the stars. All stars are distinct.
Output data
The output contains the number of L-shaped paths we have in the star map.
Constraints and clarifications
- For tests worth points,
- For tests worth more points, .
Example 1
stdin
5
5 5
8 5
5 8
5 0
0 5
stdout
4