#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long x, y, ans = 0;
  map<long long, vector<long long> > X, Y;
  map<pair<long long, long long>, int> XY;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (i > 0) {
      ans += Y[x].size() + X[y].size();
      ans -= XY[{x, y}];
    }
    X[y].push_back(x);
    Y[x].push_back(y);
    XY[{x, y}]++;
  }
  cout << ans << endl;
  return 0;
}
