#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, long long> cnt;
  map<long long, long long> cnt1;
  map<pair<long long, long long>, long long> count1;
  map<long long, long long>::iterator I;
  map<pair<long long, long long>, long long>::iterator J;
  long long t = 0, res1 = 0, sum = 0, m, n, i, j, res, c;
  cin >> n;
  long long a[200005], b[200005];
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    count1[make_pair(a[i], b[i])]++;
    cnt[a[i]]++;
    cnt1[b[i]]++;
  }
  for (J = count1.begin(); J != count1.end(); J++) {
    m = J->second;
    if (m > 1) {
      c = ((m - 1) * (m)) / 2;
      res1 += c;
    }
  }
  t = m;
  for (I = cnt.begin(); I != cnt.end(); I++) {
    m = I->second - 1;
    if (m >= 1) {
      res = (m * (m + 1)) / 2;
      sum += res;
    }
  }
  for (I = cnt1.begin(); I != cnt1.end(); I++) {
    m = I->second - 1;
    if (m >= 1) {
      res = (m * (m + 1)) / 2;
      sum += res;
    }
  }
  if (t == n) {
    t = ((n - 1) * n) / 2;
    cout << t << endl;
  } else {
    long long ans;
    ans = sum - res1;
    cout << ans << endl;
  }
  return 0;
}
