func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 500000 + 10;   int n;   vector<int> li;   struct node {     int x, y;   } p[maxn];   bool cmp1(node a, node b) { return a.x < b.x; }   bool cmp2(node a, node b) { return a.y < b.y; }   long long vis[maxn], ans;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &p[i].x, &p[i].y);       li.push_back(p[i].x), li.push_back(p[i].y);     }     sort(li.begin(), li.end());     li.erase(unique(li.begin(), li.end()), li.end());     for (int i = 1; i <= n; i++) {       p[i].x = lower_bound(li.begin(), li.end(), p[i].x) - li.begin();       p[i].y = lower_bound(li.begin(), li.end(), p[i].y) - li.begin();     }     sort(p + 1, p + n + 1, cmp1);     int st = 1, ed = 1;     long long num = 0ll;     for (; ed <= n; ed++) {       if (p[ed].x == p[st].x) {         vis[p[ed].y]++, num++;       } else {         ans += ((num - 1) * num / 2ll);         for (int i = st; i < ed; i++) {           if (vis[p[i].y]) {             ans -= ((vis[p[i].y] - 1) * vis[p[i].y] / 2ll), vis[p[i].y] = 0;           }         }         st = ed, num = 1ll;         vis[p[ed].y] = 1;       }     }     if (num) {       ans += ((num - 1) * num / 2ll);       for (int i = st; i <= n; i++) {         if (vis[p[i].y]) {           ans -= ((vis[p[i].y] - 1) * vis[p[i].y] / 2ll), vis[p[i].y] = 0;         }       }     }     sort(p + 1, p + n + 1, cmp2);     st = 1, ed = 1, num = 0ll;     for (; ed <= n; ed++) {       if (p[ed].y == p[st].y)         num++;       else {         ans += ((num - 1) * num / 2ll);         st = ed, num = 1ll;       }     }     if (num) ans += ((num - 1) * num / 2ll);     printf( %I64d n , ans);     return 0;   }   