#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  map<pair<long long, long long>, long long> visited;
  map<long long, long long> xv, yv;
  cin >> n;
  long long x, y;
  cin >> x >> y;
  xv[x] = yv[y] = 1;
  visited[{x, y}] = 1;
  long long res = 0;
  for (long long i = 1; i < n; i++) {
    cin >> x >> y;
    if (visited[{x, y}]) {
      res += visited[{x, y}];
      res += xv[x] - visited[{x, y}];
      res += yv[y] - visited[{x, y}];
      xv[x]++;
      yv[y]++;
      visited[{x, y}]++;
      continue;
    }
    if (xv[x]) res += xv[x];
    if (yv[y]) res += yv[y];
    xv[x]++;
    yv[y]++;
    visited[{x, y}]++;
  }
  cout << res;
}
