#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, c, a, x, y, d;
  cin >> n;
  std::map<long long int, long long int> watx;
  std::map<long long int, long long int> waty;
  std::map<long long int, long long int> watr;
  a = 123456;
  d = 0;
  while (d != n) {
    cin >> x >> y;
    if (watr.count(x + a * y) > 0) {
      watr[x + a * y]++;
      watx[x]++;
      waty[y]++;
      d++;
    } else if (watx.count(x) > 0 && waty.count(y) > 0) {
      watx[x]++;
      waty[y]++;
      watr[x + a * y] = 1;
      d++;
    } else if (watx.count(x) > 0) {
      watx[x]++;
      waty[y] = 1;
      watr[x + a * y] = 1;
      d++;
    } else if (waty.count(y) > 0) {
      watx[x] = 1;
      waty[y]++;
      watr[x + a * y] = 1;
      d++;
    } else {
      watx[x] = 1;
      waty[y] = 1;
      watr[x + a * y] = 1;
      d++;
    }
  }
  c = 0;
  for (std::map<long long int, long long int>::iterator it = watx.begin();
       it != watx.end(); ++it) {
    c = c + (it->second - 1) * (it->second) / 2;
  }
  for (std::map<long long int, long long int>::iterator it = waty.begin();
       it != waty.end(); ++it) {
    c = c + (it->second - 1) * (it->second) / 2;
  }
  for (std::map<long long int, long long int>::iterator it = watr.begin();
       it != watr.end(); ++it) {
    c = c - (it->second - 1) * (it->second) / 2;
  }
  cout << c;
  return 0;
}
