#include <bits/stdc++.h>
using namespace std;
string sValueOf(long long v) {
  stringstream ss;
  ss << v;
  return ss.str();
}
long long parseInt(string v) {
  long long i;
  stringstream ss(v);
  ss >> i;
  return i;
}
void fast_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main() {
  long long i, j;
  long long n;
  cin >> n;
  long long xs[200001], ys[200001];
  long long ans = 0;
  map<pair<long long, long long>, long long> memo;
  map<long long, long long> aX, aY;
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> xs[i] >> ys[i];
    memo[pair<long long, long long>(xs[i], ys[i])]++;
    aX[xs[i]]++;
    aY[ys[i]]++;
  }
  for (long long i = 0; i < (long long)(n); i++) {
    long long amo = memo[pair<long long, long long>(xs[i], ys[i])];
    if (amo == 1) continue;
    amo--;
    ans -= (amo + 1) * amo / 2;
    memo[pair<long long, long long>(xs[i], ys[i])] = 0;
  }
  for (long long i = 0; i < (long long)(n); i++) {
    long long tar = aX[xs[i]];
    tar--;
    long long tar2 = aY[ys[i]];
    tar2--;
    if (tar != -1) {
      ans += (tar + 1) * tar / 2;
    }
    if (tar2 != -1) {
      ans += (tar2 + 1) * tar2 / 2;
    }
    aX[xs[i]] = 0;
    aY[ys[i]] = 0;
  }
  cout << ans << endl;
  return 0;
}
