#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
using namespace std;
template <typename T>
ostream& operator<<(ostream& out, vector<T>& a) {
  for (auto& p : a) out << p << " ";
  return out;
}
template <typename T>
istream& operator>>(istream& inp, vector<T>& a) {
  for (auto& p : a) inp >> p;
  return inp;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout.precision(20);
  srand((signed)time(NULL));
  long long n = 0, ans = 0;
  cin >> n;
  vector<pair<long long, long long>> arr(n);
  for (auto& p : arr) cin >> p.first >> p.second;
  map<long long, long long> gx, gy;
  for (long long i = 0; i < n; i++) {
    ans += gx[arr[i].first] + gy[arr[i].second];
    gx[arr[i].first]++, gy[arr[i].second]++;
  }
  map<pair<long long, long long>, long long> gg;
  for (long long i = 0; i < n; i++) gg[arr[i]]++;
  for (auto& p : gg) ans -= p.second * (p.second - 1) / 2;
  cout << ans << "\n";
  return 0;
}
