#include <bits/stdc++.h>
using namespace std;
const long long N = 200002;
long long n, m, l, r, p, t, k, ans, sum, tot, cnt, c[N], d[N];
map<pair<long long, long long>, long long> mp, np;
map<long long, long long> mpx, mpy, mp1, mp2;
struct node {
  long long x, y;
} a[N], b[N];
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
bool cmp(node x, node y) { return x.x < y.x; }
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i].x = read(), a[i].y = read();
  sort(a + 1, a + n + 1, cmp);
  for (long long i = 1; i <= n; i++) {
    m++;
    b[m].x = a[i].x;
    b[m].y = a[i].y;
    mpx[a[i].x]++;
    mpy[a[i].y]++;
    mp[make_pair(a[i].x, a[i].y)]++;
  }
  for (long long i = 1; i <= m; i++) {
    ans +=
        max(0ll, (mpx[b[i].x] - mp1[b[i].x] - mp[make_pair(b[i].x, b[i].y)]));
    mp1[b[i].x]++;
    ans +=
        max(0ll, (mpy[b[i].y] - mp2[b[i].y] - mp[make_pair(b[i].x, b[i].y)]));
    mp2[b[i].y]++;
    mp[make_pair(b[i].x, b[i].y)]--;
    ans += mp[make_pair(b[i].x, b[i].y)];
  }
  cout << ans << endl;
  return 0;
}
