#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 10;
const long long inf = 1e9 + 9;
long long n, ans;
long long a[maxn], b[maxn];
map<long long, long long> cx, cy;
map<long long, long long> flagg;
map<long long, bool> flagx;
map<long long, bool> flagy;
inline long long Cal(long long x) { return (x * (x - 1)) >> 1; }
int main() {
  ans = 0;
  scanf("%lld", &n);
  for (register long long i = 1; i <= n; ++i) {
    scanf("%lld%lld", &a[i], &b[i]);
    if (flagg[a[i] * inf + b[i]]) {
      ans -= flagg[a[i] * inf + b[i]];
      flagg[a[i] * inf + b[i]]++;
    } else
      flagg[a[i] * inf + b[i]] = 1;
    flagx[a[i]] = 0, flagy[b[i]] = 0;
    cx[a[i]]++, cy[b[i]]++;
  }
  for (register long long i = 1; i <= n; ++i) {
    if (!flagx[a[i]]) {
      ans += Cal(cx[a[i]]);
      flagx[a[i]] = 1;
    }
    if (!flagy[b[i]]) {
      ans += Cal(cy[b[i]]);
      flagy[b[i]] = 1;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
