#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int parent[100000] = {0};
int find_set(int a) {
  if (parent[a] == a) return a;
  return parent[a] = find_set(parent[a]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) parent[b] = a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) parent[i] = i;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    union_sets(u, v);
  }
  long long ans = (1LL << n);
  for (int i = 1; i <= n; i++)
    if (parent[i] == i) ans = ans / 2;
  cout << ans << "\n";
}
