#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, ans = 0;
  cin >> n;
  map<long long, long long> row, col;
  map<pair<long long, long long>, long long> pt;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    ans += row[x] + col[y];
    row[x]++;
    col[y]++;
    pt[{x, y}]++;
  }
  for (auto i : pt) {
    long long x = i.second;
    if (x > 1) ans -= x * (x - 1) / 2;
  }
  cout << ans;
}
