#include <bits/stdc++.h>
using namespace std;
long long expo(long long x, long long n, long long m) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return expo((x * x) % m, n / 2, m);
  else
    return (x * expo((x * x) % m, (n - 1) / 2, m)) % m;
}
string DtoB(int j) {
  string s = "";
  for (int i = 32; i >= 0; i--) {
    int k = j >> i;
    if (k & 1)
      s += "1";
    else
      s += "0";
  }
  return s;
}
void solve() {
  int n;
  cin >> n;
  map<int, int> x;
  map<int, int> y;
  map<pair<int, int>, int> c;
  unsigned long long ans = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    x[a]++;
    y[b]++;
    c[make_pair(a, b)]++;
  }
  for (auto &i : x) ans += (long long)(i.second - 1) * (i.second) / 2;
  for (auto &i : y) ans += (long long)(i.second - 1) * (i.second) / 2;
  for (auto &i : c) ans -= (long long)(i.second - 1) * (i.second) / 2;
  cout << ans << endl;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
