#include <bits/stdc++.h>
using namespace std;
long long comp(long long n) {
  n = n * (n - 1) / 2;
  return n;
}
void solve() {
  long long n, x = 1, y, z, k = 0, sum = 0;
  cin >> n;
  long long a[n], b[n];
  pair<long long, long long> p[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    p[i].first = a[i];
    p[i].second = b[i];
  }
  sort(a, a + n);
  sort(b, b + n);
  sort(p, p + n);
  while (k < n - 1) {
    if (a[k] == a[k + 1]) {
      x++;
    } else {
      sum += comp(x);
      x = 1;
    }
    k++;
  }
  sum += comp(x);
  x = 1;
  k = 0;
  while (k < n - 1) {
    if (b[k] == b[k + 1]) {
      x++;
    } else {
      sum += comp(x);
      x = 1;
    }
    k++;
  }
  sum += comp(x);
  k = 0;
  x = 1;
  while (k < n - 1) {
    if (p[k] == p[k + 1]) {
      x++;
    } else {
      sum -= comp(x);
      x = 1;
    }
    k++;
  }
  sum -= comp(x);
  cout << sum;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
