#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000 + 10;
struct Dian {
  int x, y;
  bool operator<(const Dian &ot) const {
    if (x != ot.x) return x < ot.x;
    return y < ot.y;
  }
} ad[MAXN];
long long ans;
int n, tx, ty, totx[MAXN], toty[MAXN], used[MAXN];
map<int, int> ysx, ysy;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &ad[i].x, &ad[i].y);
    ad[i].x += 1e9;
    ad[i].y += 1e9;
    if (ysx[ad[i].x] == 0) ysx[ad[i].x] = ++tx;
    if (ysy[ad[i].y] == 0) ysy[ad[i].y] = ++ty;
    totx[ysx[ad[i].x]]++;
    toty[ysy[ad[i].y]]++;
  }
  sort(ad + 1, ad + n + 1);
  for (int i = 1; i <= tx; ++i) {
    int t = totx[i];
    ans += (long long)(t - 1) * t / 2;
  }
  for (int i = 1; i <= ty; ++i) {
    int t = toty[i];
    ans += (long long)(t - 1) * t / 2;
  }
  used[1] = 1;
  for (int i = 2; i <= n; ++i)
    if (ad[i].x == ad[i - 1].x && ad[i].y == ad[i - 1].y && !used[i]) {
      int t = 1;
      for (int j = i; j <= n; ++j) {
        if (ad[j].x != ad[i].x) break;
        if (!used[j] && ad[j].x == ad[i - 1].x && ad[j].y == ad[i - 1].y) {
          t++;
          used[j] = 1;
        }
      }
      if (t == 1) continue;
      ans -= (long long)t * (t - 1) / 2;
    }
  cout << ans << endl;
  return 0;
}
