#include <bits/stdc++.h>
using namespace std;
int temp, i, j, k, T;
long long pow_r(long long d, long long n) {
  long long x = 1ll;
  while (n > 0) {
    if (n & 1) x = (x * d);
    d = (d * d);
    n >>= 1;
  }
  return x;
}
int n, m;
bool vis[55];
vector<int> adj[55];
long long ans = 1;
int cnt[55];
void dfs(int v, int cc) {
  vis[v] = 1;
  ++cnt[cc];
  for (int i = 0, sz = adj[v].size(); i < sz; ++i) {
    int cur = adj[v][i];
    if (!vis[cur]) {
      dfs(cur, cc);
    }
  }
}
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  for (i = 0; i < m; ++i) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int cc = 0;
  for (i = 1; i <= n; ++i)
    if (!vis[i]) {
      dfs(i, cc);
      ++cc;
    }
  for (i = 0; i < cc; ++i)
    if (cnt[i]) {
      ans <<= (cnt[i] - 1);
    }
  cout << ans << endl;
  return 0;
}
