#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", 3, "inline")
using namespace std;
bool vis[55];
int n, m;
vector<int> adj[55];
long long ans = 1;
int cn;
void dfs(int i) {
  if (vis[i]) return;
  vis[i] = 1;
  cn++;
  if (cn > 1) ans *= 2;
  for (int j = 0; j < adj[i].size(); j++) dfs(adj[i][j]);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      cn = 0;
      dfs(i);
    }
  cout << ans;
  return 0;
}
