#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> x, y;
  map<pair<int, int>, int> points;
  int n;
  long long ans = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int xi, yi;
    cin >> xi >> yi;
    if (points.find(make_pair(xi, yi)) != points.end())
      ++points[make_pair(xi, yi)];
    else
      points[make_pair(xi, yi)] = 1;
    if (x.find(xi) == x.end())
      x[xi] = 1;
    else
      ++x[xi];
    if (y.find(yi) == y.end())
      y[yi] = 1;
    else
      ++y[yi];
  }
  for (auto i = x.begin(); i != x.end(); ++i) {
    long long num = i->second;
    if (num > 1) ans += (num - 1) * (num) / 2;
  }
  for (auto i = y.begin(); i != y.end(); ++i) {
    long long num = i->second;
    if (num > 1) ans += (num - 1) * (num) / 2;
  }
  for (auto i = points.begin(); i != points.end(); ++i) {
    long long num = i->second;
    if (num > 1) ans -= (num - 1) * num / 2;
  }
  cout << ans << endl;
  return 0;
}
