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 (*x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub>).

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 |*x*<sub class="lower-index">*i*</sub> - *x*<sub class="lower-index">*j*</sub>| + |*y*<sub class="lower-index">*i*</sub> - *y*<sub class="lower-index">*j*</sub>|. Daniel, as an ordinary person, calculates the distance using the formula <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/86553950217238f1f856b2066fa05929b39fec61.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

The success of the operation relies on the number of pairs (*i*, *j*) (1 ≤ *i* &lt; *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.
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 *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> (|*x*<sub class="lower-index">*i*</sub>|, |*y*<sub class="lower-index">*i*</sub>| ≤ 10<sup class="upper-index">9</sup>).

Some positions may coincide.
In the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/bcb5b7064b5f02088da0fdcf677e6fda495dd0df.png" style="max-width: 100.0%;max-height: 100.0%;"/> for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances.
3
1 1
7 5
1 5
2
6
0 0
0 1
0 2
-1 1
0 1
1 1
11
10
46 -55
46 45
46 45
83 -55
46 45
83 -55
46 45
83 45
83 45
46 -55
33
1
-5 -90
0
2
315 845
-669 -762
0
3
8911 7861
-6888 7861
8911 7861
3
2
-1 1000000000
0 -1
0
2
1000000000 0
-7 1
0
2
1 4
2 1
0
2
1 0
0 2333333
0
2
2 1
1 2
0
2
1 1000000000
2 -1000000000
0
2
0 1000000000
1 -7
0
2
1 0
0 19990213
0
import sys
import math
import collections
import bisect
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_list(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip()
for t in range(1):
    n=int(input())
    x_counter=dict()
    y_counter=dict()
    equal=0
    for i in range(n):
        x,y=get_ints()
        if x in x_counter:
            x_counter[x]+=1
        else:
            x_counter[x]=1
        if x==y:
            equal+=1
        if y in y_counter:
            y_counter[y]+=1
        else:
            y_counter[y]=1
    ans=0
    for i in x_counter:
        if x_counter[i]<2:
            continue
        freq=x_counter[i]
        val=math.factorial(freq)//(math.factorial(freq-2)*math.factorial(2))
        ans+=val
    for i in y_counter:
        if y_counter[i]<2:
            continue
        freq=y_counter[i]
        val=math.factorial(freq)//(math.factorial(freq-2)*math.factorial(2))
        ans+=val
    ans-=equal
    print(ans+1)