#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<int> vis;
int res = 0;
void dfs(int u) {
  vis[u] = 1;
  for (int v = 0; v < g[u].size(); v++) {
    if (!vis[g[u][v]]) {
      res++;
      dfs(g[u][v]);
    }
  }
}
int main() {
  int n, m, u, v, ans = 0;
  cin >> n >> m;
  g.resize(n);
  vis.resize(n);
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    dfs(i);
  }
  cout << fixed << setprecision(0) << pow(2, res) << endl;
  return 0;
}
