#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<int, int> x, y;
  vector<long long> v1(n), v2(n);
  map<pair<long long, long long>, long long> mp;
  long long cnt = 0;
  for (auto i = 0; i < (long long)(n); i++) {
    cin >> v1[i] >> v2[i];
    mp[{v1[i], v2[i]}]++;
    x[v1[i]]++, y[v2[i]]++;
  }
  for (auto i = 0; i < (long long)(n); i++) {
    x[v1[i]]--, y[v2[i]]--;
    mp[{v1[i], v2[i]}]--;
    cnt += x[v1[i]] + y[v2[i]] - mp[{v1[i], v2[i]}];
  }
  cout << cnt;
  return 0;
}
