#include <bits/stdc++.h>
using namespace std;
const int maxn = int(2e5) + 100;
struct point {
  int x, y;
};
int n;
int lsh[maxn];
long long sum[maxn];
long long ans;
point a[maxn];
bool cmp1(point b, point c) { return (b.x < c.x || (b.x == c.x && b.y < c.y)); }
bool cmp2(point b, point c) { return b.y < c.y; }
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].x, &a[i].y);
}
void solve() {
  sort(a + 1, a + 1 + n, cmp1);
  lsh[0] = 1;
  lsh[1] = a[1].x;
  sum[1] = 1;
  for (int i = 2; i <= n; ++i)
    if (lsh[lsh[0]] != a[i].x) {
      lsh[++lsh[0]] = a[i].x;
      sum[lsh[0]] = 1;
    } else
      ++sum[lsh[0]];
  for (int i = 1; i <= lsh[0]; ++i) ans += (sum[i] - 1) * sum[i] / 2;
  sort(a + 1, a + 1 + n, cmp2);
  lsh[0] = 1;
  lsh[1] = a[1].y;
  sum[1] = 1;
  for (int i = 2; i <= n; ++i)
    if (lsh[lsh[0]] != a[i].y) {
      lsh[++lsh[0]] = a[i].y;
      sum[lsh[0]] = 1;
    } else
      ++sum[lsh[0]];
  for (int i = 1; i <= lsh[0]; ++i) ans += (sum[i] - 1) * sum[i] / 2;
  sort(a + 1, a + 1 + n, cmp1);
  lsh[0] = 1;
  lsh[1] = 1;
  sum[1] = 1;
  for (int i = 2; i <= n; ++i)
    if (a[i].x == a[lsh[lsh[0]]].x && a[i].y == a[lsh[lsh[0]]].y)
      ++sum[lsh[0]];
    else {
      lsh[++lsh[0]] = i;
      sum[lsh[0]] = 1;
    }
  for (int i = 1; i <= lsh[0]; ++i) ans -= (sum[i] - 1) * sum[i] / 2;
}
int main() {
  init();
  solve();
  printf("%I64d\n", ans);
  return 0;
}
