#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; (ch < '0' || ch > '9') && (ch != '-'); ch = getchar())
    ;
  if (ch == '-') ch = getchar(), f = -1;
  for (; ch <= '9' && ch >= '0'; x = x * 10 + ch - 48, ch = getchar())
    ;
  return x * f;
}
int i, j, k, m, n, x, last, y;
long long ans;
struct node {
  int x, y;
  bool operator<(const node& b) const {
    return (x < b.x) || (x == b.x && y < b.y);
  }
} q[200200];
map<node, int> mp;
inline bool cmp1(node a, node b) { return a.x < b.x; }
inline bool cmp2(node a, node b) { return a.y < b.y; }
int main() {
  for (n = read(), i = 1; i <= n; ++i)
    q[i].x = read(), q[i].y = read(), ++mp[q[i]];
  q[n + 1] = (node){-0x7f7f7f, -0x7f7f7f};
  sort(q + 1, q + n + 1, cmp1);
  for (last = 1, i = 2; i <= n + 1; ++i)
    if (q[i].x != q[i - 1].x)
      ans += 1ll * (i - 1 - last + 1) * ((i - 1 - last + 1 - 1)) / 2, last = i;
  sort(q + 1, q + n + 1, cmp2);
  for (last = 1, i = 2; i <= n + 1; ++i)
    if (q[i].y != q[i - 1].y)
      ans += 1ll * (i - 1 - last + 1) * ((i - 1 - last + 1 - 1)) / 2, last = i;
  for (i = 1; i <= n; ++i)
    if (mp[q[i]] > 1)
      ans -= 1ll * (mp[q[i]] - 1) * (mp[q[i]]) / 2, mp[q[i]] = 0;
  printf("%I64d\n", ans);
}
