#include <bits/stdc++.h>
using namespace std;
vector<long long> arr[51];
long long vis[51];
long long cnt = 0;
void dfs(long long node) {
  vis[node] = 1;
  cnt++;
  for (auto x : arr[node]) {
    if (vis[x]) continue;
    dfs(x);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long u, v;
  for (long long i = 1; i <= m; i++)
    cin >> u >> v, arr[u].push_back(v), arr[v].push_back(u);
  long long ans = 0;
  long long temp = 0;
  for (long long i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dfs(i);
    cnt--;
    temp += cnt;
    cnt = 0;
  }
  cout << (1ll << temp) << "\n";
  return 0;
}
