#include <bits/stdc++.h>
typedef struct node {
  int x, y;
} p;
p a[200005];
int cmp1(const void* a, const void* b) {
  p* c = (p*)a;
  p* d = (p*)b;
  return c->x - d->x;
}
int cmp2(const void* a, const void* b) {
  p* c = (p*)a;
  p* d = (p*)b;
  if (c->y != d->y)
    return c->y - d->y;
  else
    return d->x - c->x;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
  }
  a[n].x = 1e9 + 5;
  a[n].y = 1e9 + 5;
  qsort(a, n, sizeof(a[0]), cmp1);
  long long ans = 0;
  int last = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i].x == a[i - 1].x)
      last++;
    else {
      ans += 1LL * last * (last + 1) / 2;
      last = 0;
    }
  }
  last = 0;
  int fo = 0;
  qsort(a, n, sizeof(a[0]), cmp2);
  for (int i = 1; i <= n; i++) {
    if (a[i].y == a[i - 1].y)
      last++;
    else {
      ans += 1LL * last * (last + 1) / 2;
      last = 0;
    }
    if (a[i].x == a[i - 1].x && a[i].y == a[i - 1].y)
      fo++;
    else {
      ans -= 1LL * fo * (fo + 1) / 2;
      fo = 0;
    }
  }
  printf("%I64d\n", ans);
}
