#include <bits/stdc++.h>
using namespace std;
const int MX_SZ = 66;
vector<int> g[MX_SZ];
vector<bool> used(MX_SZ, false);
int counter = 0;
void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < (int)g[v].size(); i++) {
    if (!used[g[v][i]]) {
      dfs(g[v][i]);
    }
  }
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int t1, t2;
    cin >> t1 >> t2;
    g[t1].push_back(t2);
    g[t2].push_back(t1);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) {
      dfs(i);
      counter++;
    }
  }
  long long ans = 1;
  for (int i = 0; i < n - counter; i++) {
    ans *= 2;
  }
  cout << ans;
}
