#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 55;
const long long INF = 3 * 1e9;
const long long MOD = 1000000007;
vector<long long> adj[MAXN];
bool visited[MAXN];
long long c;
void DFS(long long v) {
  c++;
  visited[v] = 1;
  for (auto u : adj[v])
    if (!visited[u]) DFS(u);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long step = 0;
  for (long long i = 0; i < m; ++i) {
    long long x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (long long i = 1; i <= n; ++i) {
    if (visited[i]) continue;
    c = 0;
    DFS(i);
    step += c - 1;
  }
  long long ans = 1;
  for (long long i = 0; i < step; ++i) ans *= 2;
  cout << ans;
  return 0;
}
