#include <bits/stdc++.h>   using namespace std;   int n;   pair<int, int> point[int(2e5 + 10)];   map<int, int> mark_x, mark_y;   long long res;   void sol() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> point[i].first >> point[i].second;       mark_x[point[i].first]++;       mark_y[point[i].second]++;     }     sort(point, point + n);     for (int i = 0; i < n; i++) {       if (i == 0 || point[i].first != point[i - 1].first) {         for (int j = i; point[j].first == point[i].first && j < n; j++) {           mark_y[point[j].second]--;         }       }       mark_x[point[i].first]--;       res += mark_x[point[i].first];       res += mark_y[point[i].second];     }     cout << res;   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     sol();     return 0;   }   