#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
pair<int, int> a[200004], b[200004];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    s.insert({l, r});
    a[i].first = l;
    a[i].second = r;
    b[i].first = r;
    b[i].second = l;
  }
  sort(a, a + n);
  sort(b, b + n);
  a[n].first = 1e9 + 9;
  b[n].first = 1e9 + 9;
  b[n].second = 1e9 + 9;
  long long l = 1;
  int k = n - s.size();
  long long S = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i].first == a[i - 1].first)
      l++;
    else {
      S += 1ll * l * (l - 1) / 2;
      l = 1;
    }
  }
  l = 1;
  for (int i = 1; i <= n; ++i) {
    if (b[i].first == b[i - 1].first)
      l++;
    else {
      S += 1ll * l * (l - 1) / 2;
      l = 1;
    }
  }
  l = 1;
  for (int i = 1; i <= n; ++i) {
    if (b[i].first == b[i - 1].first && b[i].second == b[i - 1].second)
      l++;
    else {
      S -= 1ll * l * (l - 1) / 2;
      l = 1;
    }
  }
  cout << S;
}
