#include <bits/stdc++.h>
using namespace std;
long long a[55];
struct DSU {
  long long sze[55], arr[55];
  void init() {
    for (long long i = 1; i < 55; i++) arr[i] = i, sze[i] = 1;
  }
  void get_union(long long a, long long b) {
    long long root_a = root(a), root_b = root(b);
    if (sze[root_a] < sze[root_b])
      arr[root_a] = arr[root_b], sze[root_b] += sze[root_a];
    else
      arr[root_b] = arr[root_a], sze[root_a] += sze[root_b];
  }
  long long root(long long x) {
    while (arr[x] != x) arr[x] = arr[arr[x]], x = arr[x];
    return x;
  }
} dsu;
long long powm(long long base, long long exp) {
  long long ans = 1;
  while (exp) {
    if (exp & 1) ans = (ans * base);
    exp >>= 1, base = (base * base);
  }
  return ans;
}
int main() {
  long long n, m, x, y, ans = 0;
  scanf("%lld", &n), scanf("%lld", &m);
  dsu.init();
  while (m--) {
    scanf("%lld", &x), scanf("%lld", &y);
    dsu.get_union(x, y);
  }
  for (long long i = 1; i < n + 1; i++)
    if (dsu.root(i) == i) ans++;
  printf("%lld", powm(2, n - ans));
  return 0;
}
