#include <bits/stdc++.h>
using namespace std;
int n, m, sol;
bool v[55];
vector<int> g[55];
void dfs(int nod) {
  v[nod] = 1;
  ++sol;
  for (size_t i = 0; i < g[nod].size(); ++i) {
    int vecin = g[nod][i];
    if (!v[vecin]) dfs(vecin);
  }
}
int main() {
  int i, j;
  cin >> n >> m;
  while (m--) {
    cin >> i >> j;
    g[i].push_back(j);
    g[j].push_back(i);
  }
  for (i = 1; i <= n; ++i)
    if (!v[i]) {
      --sol;
      dfs(i);
    }
  cout << (1LL << sol);
  return 0;
}
