#include <bits/stdc++.h>
using namespace std;
long long answer;
map<int, int> x, y;
map<pair<int, int>, int> a;
int main() {
  int n, d, c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d >> c;
    answer += x[d];
    answer += y[c];
    answer -= a[make_pair(d, c)];
    x[d]++;
    y[c]++;
    a[make_pair(d, c)]++;
  }
  cout << answer;
}
