#include <bits/stdc++.h>
struct op {
  long long x, y;
} p[200005];
long long y[200005], x[200005], xx, yy, n, ans, nx[200005], ny[200005];
bool cmp(op q, op w) {
  if (q.x == w.x) return q.y < w.y;
  return q.x < w.x;
}
int main() {
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &xx, &yy);
    x[++x[0]] = xx;
    y[++y[0]] = yy;
    p[i].x = xx;
    p[i].y = yy;
  }
  std::sort(p + 1, p + 1 + n, cmp);
  std::sort(x + 1, x + 1 + x[0]);
  std::sort(y + 1, y + 1 + y[0]);
  long long tx = 1;
  nx[1] = 1;
  for (long long i = 2; i <= x[0]; i++)
    if (x[i] != x[i - 1])
      x[++tx] = x[i], nx[tx] = 1;
    else
      nx[tx]++;
  x[0] = tx;
  long long ty = 1;
  ny[1] = 1;
  for (long long i = 2; i <= y[0]; i++)
    if (y[i] != y[i - 1])
      y[++ty] = y[i], ny[ty] = 1;
    else
      ny[ty]++;
  y[0] = ty;
  for (long long i = 1; i <= x[0]; i++)
    if (nx[i] > 1) ans += (nx[i] * (nx[i] - 1)) / 2;
  for (long long i = 1; i <= y[0]; i++)
    if (ny[i] > 1) ans += (ny[i] * (ny[i] - 1)) / 2;
  long long cnt = 1;
  for (long long i = 2; i <= n; i++)
    if (p[i].x == p[i - 1].x && p[i].y == p[i - 1].y) {
      cnt++;
    } else {
      if (cnt > 1) ans -= (cnt - 1) * cnt / 2;
      cnt = 1;
    }
  if (cnt > 1) ans -= (cnt - 1) * cnt / 2;
  printf("%I64d\n", ans);
}
