#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> visX, visY;
struct point {
  int x, y;
  point(int X, int Y) { x = X, y = Y; }
  bool operator<(point other) const {
    if (x != other.x) return x < other.x;
    return y < other.y;
  }
  bool operator==(point other) const { return x == other.x && y == other.y; }
};
set<point> st;
map<point, int> repeted;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    visX[x]++;
    visY[y]++;
    if (st.count(point(x, y)))
      repeted[point(x, y)]++;
    else
      st.insert(point(x, y));
  }
  long long ans = 0ll;
  for (typeof(visX.begin()) it = visX.begin(); it != visX.end(); it++) {
    long long cnt = it->second;
    ans += (cnt * (cnt - 1ll)) / 2ll;
  }
  for (typeof(visY.begin()) it = visY.begin(); it != visY.end(); it++) {
    long long cnt = it->second;
    ans += (cnt * (cnt - 1ll)) / 2ll;
  }
  long long rep = 0;
  for (typeof(repeted.begin()) it = repeted.begin(); it != repeted.end();
       it++) {
    long long cnt = it->second + 1;
    rep += (cnt * (cnt - 1ll)) / 2ll;
  }
  cout << ans - rep << endl;
}
