#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
const int N = 1e6, MOD = 1e9 + 7, INF = 1e9, miniINF = 1e5;
const long long bigINF = 1e18;
const double EPS = 1e-9;
long long n, x, y, cnt;
map<long long, long long> mpx, mpy;
set<long long> stx, sty;
map<pair<long long, long long>, long long> u;
long long schetchik(long long x) {
  long long cnt = 0;
  for (int i = 1; i < x + 1; ++i) {
    cnt += i;
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    stx.insert(x);
    sty.insert(y);
    mpx[x]++;
    mpy[y]++;
    cnt -= u[{x, y}];
    u[{x, y}]++;
  }
  for (auto& i : stx) {
    cnt += schetchik(mpx[i] - 1);
  }
  for (auto& i : sty) {
    cnt += schetchik(mpy[i] - 1);
  }
  cout << cnt;
}
