#include <bits/stdc++.h>
using namespace std;
const int N = 3e5;
int n;
map<pair<int, int>, int> mm;
map<int, int> dx, dy;
int xx[N], yy[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    mm[make_pair(x, y)]++;
    dx[x]++;
    dy[y]++;
    xx[i] = x;
    yy[i] = y;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = ans + dx[xx[i]] - 1;
    ans = ans + dy[yy[i]] - 1;
  }
  for (map<pair<int, int>, int>::iterator it = mm.begin(); it != mm.end();
       it++) {
    long long t = (*it).second;
    ans -= t * (t - 1);
  }
  cout << ans / 2 << endl;
  return 0;
}
