Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).

They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers the distance between watchmen i and j to be |xi - xj| + |yi - yj|. Daniel, as an ordinary person, calculates the distance using the formula <image>.

The success of the operation relies on the number of pairs (i, j) (1 ≤ i < j ≤ n), such that the distance between watchman i and watchmen j calculated by Doctor Manhattan is equal to the distance between them calculated by Daniel. You were asked to compute the number of such pairs.

Input

The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen.

Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109).

Some positions may coincide.

Output

Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel.

Examples

Input

3
1 1
7 5
1 5


Output

2


Input

6
0 0
0 1
0 2
-1 1
0 1
1 1


Output

11

Note

In the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and <image> for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances.
'''
To solve this problem we need several steps of thinking. So bear with it :D (y).

The first thing to do is realize that the formula used by Dr. Manhattan & Daniel would result in same value if Xi = Xj or Yi = Yj.
We could get this conclusion by solving the equations used by them: formula(Dr. Manhattan) = formula(Daniel).

After we realize this property, our next step is to count the pairs which having the same value. We could done this naively by
generating the pairs one by one then check whether each pair generated having same x or y or not. This approach would having at
least O(n*n) complexity. Yet the maximum number of n is pretty much large (200,000) thus it is not good idea to use this approach
because most likely it will hit the time limit (this was actually what I'd done in my older submissions).

So we need to look for another approach. Apparently we could get the number of pairs by knowing only the occurrence of the points.
Notice following example: (1,0) => 5, if we try to generate pairs out of this points it would be:

(1,0) (1,0) |
(1,0) (1,0) | (1,0) (1,0) | 
(1,0) (1,0) | (1,0) (1,0) | (1,0) (1,0) |
(1,0) (1,0) | (1,0) (1,0) | (1,0) (1,0) | (1,0) (1,0)

Notice following property: if we have 5 points, then we could generate 4 + 3 + 2 + 1 of pairs. Apparenlty this property also yield
for any number of points. Thus if we have n points then we could calculate the number of pairs with following sequence:

(x - 1) + (x - 2) + ... + 1

If we look closely, this sequence is arithmetic sequence. In arithmetic sequence we know that we could calculate the sum of sequence
by using following formula:

Sn = n * (A + An) / 2

Thus in our case the formula would be:

Sx = (x - 1) * (x - 1 + 1) / 2 = (x - 1) * x / 2 = x * (x - 1) / 2

Ok, so now we could know the number of pairs if we have the number of points. By using this property we realize that we could somehow 
know the number of pairs which have same result in both formulas by using only the occurrence of points in the input.

Since we know that the pairs which have same result in both formulas is having either Xi = Xj or Yi = Yj, then we could also include
the points which having either same value of X or Y in single calculation. Notice following case: (1,0): 3, (1,2): 3

(1,0) (1,0) |
(1,0) (1,0) | (1,0) (1,0) | 
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) |
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) | (1,2) (1,2) |
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) | (1,2) (1,2) | (1,2) (1,2)

The number of pairs which having the same result in both formulas would be 5 + 4 + 3 + 2 + 1 = 15

Thus basically we could just count the occurrence of either X or Y in points to get the number of pairs which having the same result.
But since we have X & Y components in each point then we will count the pairs twice, thus we need somehow to eliminate these impurities.

Notice following case: (1,0): 3, this will result in occur_X = {1: 3} & occur_Y = {0: 3}. Thus to eliminate the another 3 we need to 
subtract it with the occurence of point (1,0) which is 3. Thus we could get the pure occurrence of (1,y) (or (x,0) if you prefer to use
this notion instead).

Thus in case: (1,0): 3, (1,2): 3, the 0 in (1,0) will be subtracted by the occurrence of (1,0) & the 2 in (1,2) will be subtracted by the occurrence of (1,2). Thus resulted in 6 occurrence of (1,y) which resulted in 5 + 4 + 3 + 2 + 1 = 15 number of pairs.

Thus the formulation would be:

num of pairs which have same formula result = num of X (1,0) + num of X (1,2) + num of Y (1,0) + num of Y (1,2) - occurrence of (1,0) - occurrence of (1,2)

But there is another catch we need to consider, which is if X & Y components in (x, a) & (b, y) having intersection. Notice following case: (1,0): 3, (1,2): 3, (2,2): 2

|1|, 0
|1|, 0 
|1|, 0
|1|,|2| -> intersection
|1|,|2| -> intersection
|1|,|2| -> intersection
 2 ,|2|
 2 ,|2|

The resulted pairs would be:

   col: 1       col: 2        col: 3        col: 4         col: 5        col: 6       col: 7

(1,0) (1,0) |
(1,0) (1,0) | (1,0) (1,0) | 
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) |
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) | (1,2) (1,2) |
(1,0) (1,2) | (1,0) (1,2) | (1,0) (1,2) | (1,2) (1,2) | (1,2) (1,2) |
(1,0) (2,2) | (1,0) (2,2) | (1,0) (2,2) | (1,2) (2,2) | (1,2) (2,2) | (1,2) (2,2) |
(1,0) (2,2) | (1,0) (2,2) | (1,0) (2,2) | (1,2) (2,2) | (1,2) (2,2) | (1,2) (2,2) | (2,2) (2,2)

  same: 5       same: 4       same: 3       same: 4       same: 3       same: 2       same: 1

Notice that there is somekind of "cut-off" happening in transition of col 3 to col 4. The amount of cut-off is same with the amount of pairs
generated from occurrence of (1,2) three times. Thus in our formula, we need also to include this cut-off which resulted into:

num of pairs which have same formula result = num of X (1,0) + num of X (1,2) + num of X (2,2) + num of Y (1,0) + num of Y (1,2) + nmum of Y (2,2) - occurence of (1,0) - occurrence of (2,2) - occurrence of (1,2); where occurrence of (1,2) is the cut-off.

'''

n = input()
occur_X, occur_Y, occur_XY = {}, {}, {} # dicts for counting occurrence

def num_pairs(occur_dict):
    return sum((x * (x - 1) / 2) for x in occur_dict.values()) # the formula to count number of pairs from occurrence of points

for i in range(0, n):
    
    # read input
    x, y = map(int, raw_input().split(' '))
    
    # fill occurrence dictionaries
    occur_X[x] = occur_X.get(x, 0) + 1
    occur_Y[y] = occur_Y.get(y, 0) + 1
    occur_XY[(x,y)] = occur_XY.get((x,y), 0) + 1
    
print(num_pairs(occur_X) + num_pairs(occur_Y) - num_pairs(occur_XY)) # num of pairs which have same formula result