369. Game

Time limit per test: 0.75 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Vasya loves his new game which is played on an infinite rectangular grid where K cells are initially black, all other cells are white. The move of the game is to find three black cells which are vertices of some rectangle with sides parallel to coordinate axis such that the fourth vertex of the rectangle is white. In this case you need to paint the fourth vertex black. Vasya asks you to write a program which calculates the number of black cells in the end of the game, i.e. when no more moves can be made.

Input
The first line contains an integer K (0 ≤ K≤ 2· 105). The next K lines contain two integers each — coordinates of black cells Xi and Yi (-109Xi, Yi ≤ 109).

Output
Output the answer to the task.

Example(s)
sample input
sample output
3
1 1
1 2
2 2
4

sample input
sample output
5
0 0
1 0
0 1
1 2
2 1
9