#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void ZZ(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
template <typename Arg1>
void ZZ(Arg1&& arg1) {
  cerr << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void ZZ(Arg1&& arg1, Args&&... args) {
  cerr << arg1 << ' ';
  ZZ(args...);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  unordered_map<long long, long long> mx, my;
  map<pair<long long, long long>, long long> mm;
  long long ans = 0;
  for (auto i = (0); i < (n); i++) {
    long long x, y;
    cin >> x >> y;
    ans += ++mx[x] + ++my[y] - 2;
    ans -= ++mm[{x, y}] - 1;
  }
  cout << ans;
}
