#include <bits/stdc++.h>
using namespace std;
bool checkbitt(long long int num, int pos);
long long int setbitt(long long int num, long long int pos);
long long int resetbitt(long long int num, int pos);
const long long int mod = 1e9 + 7;
const long long int N = 1e6 + 10;
long long int count(long long int x) {
  x--;
  return (x * (x + 1)) / 2;
}
int solve() {
  int n;
  cin >> n;
  pair<int, int> arr[n];
  map<int, int> a;
  map<int, int> b;
  map<pair<int, int>, int> c;
  long long int bad = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
    a[arr[i].first]++;
    b[arr[i].second]++;
    c[arr[i]]++;
    bad += c[arr[i]] - 1;
  }
  long long int res = 0;
  for (auto x : a) {
    res += count(x.second);
  }
  for (auto x : b) {
    res += count(x.second);
  }
  cout << res - bad << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int cs = 1;
  int cn = 1;
  while (cs--) {
    solve();
  }
}
bool checkbitt(long long int num, int pos) { return (num >> pos) & 1; }
long long int setbitt(long long int num, long long int pos) {
  return (1 << pos) | num;
}
long long int resetbitt(long long int num, int pos) {
  if (!checkbitt(num, pos))
    return num;
  else
    return (1 << pos) ^ num;
}
