#include <bits/stdc++.h>   using namespace std;   map<int, long long> x, y;   map<pair<int, int>, long long> xy;   int main() {     int n;     cin >> n;     while (n--) {       int xx, yy;       cin >> xx >> yy;       x[xx]++;       y[yy]++;       xy[make_pair(xx, yy)]++;     }     long long ans = 0;     for (auto i : x) {       ans += i.second * (i.second - 1) / 2;     }     for (auto i : y) {       ans += i.second * (i.second - 1) / 2;     }     for (auto i : xy) {       ans -= i.second * (i.second - 1) / 2;     }     cout << ans << endl;   }   