#include <bits/stdc++.h>
using namespace std;
const int N = 400010;
long long i, j, n, m, k, a[N], b[N], ans;
map<long long, long long> M, MM, S, SS;
map<pair<long long, long long>, long long> MMM, SSS;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    M[a[i]]++;
    MM[b[i]]++;
    MMM[make_pair(a[i], b[i])]++;
  }
  ans = 0;
  for (i = 0; i < n; i++) {
    if (SSS[make_pair(a[i], b[i])] == 0) {
      long long k = MMM[make_pair(a[i], b[i])];
      k = k * (k - 1) / 2;
      ans -= k;
    }
    if (S[a[i]] == 0) {
      long long k = M[a[i]];
      k = k * (k - 1) / 2;
      ans += k;
    }
    if (SS[b[i]] == 0) {
      long long k = MM[b[i]];
      k = k * (k - 1) / 2;
      ans += k;
    }
    S[a[i]] = 1;
    SS[b[i]] = 1;
    SSS[make_pair(a[i], b[i])] = 1;
  }
  cout << ans;
  return 0;
}
