#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const int N = 1e5;   class union_find {     int n, no_of_comp;     vector<int> par, sz;       public:     union_find(int nv) {       n = no_of_comp = nv;       par = sz = vector<int>(n + 1, 1);       for (int i = 1; i <= n; i++) par[i] = i;     }     int get_root(int i) {       while (i != par[i]) i = par[i];       return i;     }     void take_union(int i, int j) {       int u = get_root(i);       int v = get_root(j);       if (u == v) return;       if (sz[u] < sz[v]) swap(u, v);       par[v] = u;       sz[u] += sz[v];       no_of_comp--;     }     int num_of_comp() { return no_of_comp; }   };   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     union_find dsu(n);     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       dsu.take_union(u, v);     }     cout << (long long)pow(2, n - dsu.num_of_comp());   }   