#include <bits/stdc++.h>
using namespace std;
const double eps = 1E-8;
const int dx4[4] = {1, 0, 0, -1};
const int dy4[4] = {0, -1, 1, 0};
const int inf = 0x3f3f3f3f;
const int N = 2E6 + 7;
struct node {
  int x, y;
  bool operator<(node b) const {
    if (x == b.x) return y < b.y;
    return x < b.x;
  }
} p[N];
bool cmp(node a, node b) { return a.y < b.y; }
long long cal(long long x) {
  long long res = x * (x + 1) / 2;
  return res;
}
int n;
long long a, b, c;
long long cnta, cntb, cntc;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y;
  sort(p + 1, p + n + 1);
  a = b = c = 0LL;
  cnta = cntb = cntc = 0LL;
  for (int i = 1; i <= n - 1; i++) {
    if (p[i].x == p[i + 1].x) {
      cnta++;
    } else {
      a += cal(cnta);
      cnta = 0;
    }
  }
  a += cal(cnta);
  for (int i = 1; i <= n - 1; i++) {
    if (p[i].x == p[i + 1].x && p[i].y == p[i + 1].y) {
      cntc++;
    } else {
      c += cal(cntc);
      cntc = 0;
    }
  }
  c += cal(cntc);
  sort(p + 1, p + n + 1, cmp);
  for (int i = 1; i <= n - 1; i++) {
    if (p[i].y == p[i + 1].y) {
      cntb++;
    } else {
      b += cal(cntb);
      cntb = 0;
    }
  }
  b += cal(cntb);
  long long ans = 0LL;
  ans = a + b - c;
  cout << ans << endl;
  return 0;
}
