#include <bits/stdc++.h>
using namespace std;
const int M4 = 1e4 + 100, M5 = 1e5 + 100, M6 = 1e6 + 100, M7 = 1e7 + 100,
          M8 = 1e8 + 100, M9 = 1e9 + 100;
vector<int> adj[100];
int v;
bool mark[100];
void dfs(int u) {
  mark[u] = 1;
  for (int w : adj[u]) {
    if (!mark[w]) dfs(w);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[v].push_back(u), adj[u].push_back(v);
  }
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) v++, dfs(i);
  }
  cout << (1ll << (n - v));
  return 0;
}
