#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int n;
pair<int, int> p[500001];
map<pair<int, int>, int> M;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &p[i].first, &p[i].second);
  long long ans = 0;
  sort(p + 1, p + 1 + n);
  for (int i = 1; i <= n; i++) {
    int tmp = i;
    while (tmp <= n && p[tmp].first == p[i].first) ++tmp;
    --tmp;
    int len = tmp - i + 1;
    ans += 1LL * len * (len - 1) / 2;
    i = tmp;
  }
  for (int i = 1; i <= n; i++) swap(p[i].first, p[i].second);
  sort(p + 1, p + 1 + n);
  for (int i = 1; i <= n; i++) {
    int tmp = i;
    while (tmp <= n && p[tmp].first == p[i].first) ++tmp;
    --tmp;
    int len = tmp - i + 1;
    ans += 1LL * len * (len - 1) / 2;
    i = tmp;
  }
  for (int i = 1; i <= n; i++) {
    ans -= M[p[i]];
    M[p[i]]++;
  }
  printf("%I64d\n", ans);
  return 0;
}
