func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long p = 1e9 + 7;   struct aaa {     long long x, y;   } a[200010];   long long n, ans = 1, sz[500010], fa[500010], v[500010], fac[500010],                aa[500010], bb[500010], cnt0, cnt1;   map<long long, long long> mp0, mp1;   long long find(long long x) {     if (x == fa[x]) return x;     return fa[x] = find(fa[x]);   }   int main() {     long long i, x, y;     scanf( %lld , &n);     fac[0] = 1;     for (i = 1; i <= n * 2; i++) fac[i] = fac[i - 1] * 2 % p;     for (i = 1; i <= n; i++) {       scanf( %lld%lld , &a[i].x, &a[i].y);       aa[i] = a[i].x;       bb[i] = a[i].y;     }     sort(aa + 1, aa + n + 1);     sort(bb + 1, bb + n + 1);     for (i = 1; i <= n; i++) {       if (i == 1 || aa[i] != aa[i - 1]) mp0[aa[i]] = ++cnt0;     }     for (i = 1; i <= n; i++) {       if (i == 1 || bb[i] != bb[i - 1]) mp1[bb[i]] = ++cnt1;     }     for (i = 1; i <= cnt0 + cnt1; i++) fa[i] = i, sz[i] = 1;     for (i = 1; i <= n; i++) {       x = find(mp0[a[i].x]);       y = find(cnt0 + mp1[a[i].y]);       if (x != y) {         fa[x] = y;         v[y] |= v[x];         sz[y] += sz[x];       } else         v[x] = 1;     }     for (i = 1; i <= cnt0 + cnt1; i++)       if (fa[i] == i) {         if (v[i])           ans = ans * fac[sz[i]] % p;         else           ans = ans * (fac[sz[i]] - 1 + p) % p;       }     printf( %lld , ans);   }   