#include <bits/stdc++.h>
using namespace std;
int fact(int n) {
  if (n == 0) {
    return 1;
  }
  return n * fact(n - 1);
}
int64_t choose(int n, int k) {
  int64_t result = 1;
  if (k > n - k) {
    k = n - k;
  }
  for (int i = 0; i < k; i++) {
    result *= (n - i);
    result /= (i + 1);
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<int, int> x;
  map<int, int> y;
  map<pair<int, int>, int> seen;
  int input;
  int xc, yc;
  int64_t duplicates = 0;
  for (int i = 0; i < n; i++) {
    cin >> xc;
    cin >> yc;
    seen[make_pair(xc, yc)]++;
    x[xc]++;
    y[yc]++;
  }
  int64_t pairs = 0;
  for (auto it : seen) {
    auto pair = it.first;
    if (seen[pair] > 1) {
      duplicates += choose(seen[pair], 2);
    }
  }
  pairs -= duplicates;
  for (auto it : x) {
    int xc = it.first;
    if (x[xc] > 1) {
      pairs += choose(x[xc], 2);
    }
  }
  for (auto it : y) {
    int yc = it.first;
    if (y[yc] > 1) {
      pairs += choose(y[yc], 2);
    }
  }
  cout << pairs;
  cout << '\n';
  return 0;
}
