#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
void solveCP311() {
  int n;
  cin >> n;
  vector<pair<int, int>> vec;
  map<pair<int, int>, int> mp;
  map<int, int> x, y;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    vec.push_back({a, b});
    mp[{a, b}]++;
    x[a]++;
    y[b]++;
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    int a = vec[i].first;
    int b = vec[i].second;
    ans += x[a] + y[b] - mp[{a, b}] - 1;
    x[a]--;
    y[b]--;
    mp[{a, b}]--;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solveCP311();
  }
  return 0;
}
