#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const long long NINF = -INF;
const long long MAXN = 1e+6 + 8;
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
long long t = 1;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
;
long long n, x, y;
vector<pair<long long, long long> > v;
bool cmp(const pair<long long, long long> &a,
         const pair<long long, long long> &b) {
  return (a.second < b.second or (a.second == b.second and a.first < b.first));
}
void MAIN() {
  cin >> n;
  for (long long i = (0); i <= (n - 1); i++) {
    cin >> x >> y;
    v.push_back({x, y});
  }
  long long ans = 0;
  sort(v.begin(), v.end());
  for (long long i = 0, j = 0; i < n; i = j) {
    while (j < n and v[j].first == v[i].first) j++;
    ans += (j - i) * (j - i - 1) / 2;
  }
  sort(v.begin(), v.end(), cmp);
  for (long long i = 0, j = 0; i < n; i = j) {
    while (j < n and v[i].second == v[j].second) j++;
    ans += (j - i) * (j - i - 1) / 2;
  }
  for (long long i = 0, j = 0; i < n; i = j) {
    while (j < n and v[i].first == v[j].first and v[i].second == v[j].second)
      j++;
    ans -= (j - i) * (j - i - 1) / 2;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  while (t--) {
    MAIN();
  }
}
