#include <bits/stdc++.h>
using namespace std;
bool sortbyfir(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  if (a.first == b.first) return (a.second < b.second);
  return (a.first < b.first);
}
bool sortbysec(const pair<long long int, long long int> &a,
               const pair<long long int, long long int> &b) {
  return (a.second < b.second);
}
int main() {
  int n, tempx, tempy;
  long long int count = 0;
  pair<long long int, long long int> tx[200001], ty[200001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tempx >> tempy;
    tx[i] = make_pair(tempx, tempy);
    ty[i] = tx[i];
  }
  sort(tx, tx + n, sortbyfir);
  sort(ty, ty + n, sortbysec);
  long long int k = 0, same = 0;
  for (int i = 0; i < n - 1; i++) {
    if (tx[i].first == tx[i + 1].first) {
      if (tx[i].second == tx[i + 1].second)
        same++;
      else {
        count -= same * (same + 1) / 2;
        same = 0;
      }
      k++;
    } else {
      count -= same * (same + 1) / 2;
      same = 0;
      count += k * (k + 1) / 2;
      k = 0;
    }
  }
  count += k * (k + 1) / 2;
  k = 0;
  count -= same * (same + 1) / 2;
  for (int i = 0; i < n - 1; i++) {
    if (ty[i].second == ty[i + 1].second)
      k++;
    else {
      count += k * (k + 1) / 2;
      k = 0;
    }
  }
  count += k * (k + 1) / 2;
  cout << count << endl;
}
