#include <bits/stdc++.h>
using namespace std;
int n, m, p[51], Size[51];
long long Danger = 1;
void Create(int x) {
  p[x] = x;
  Size[x] = 1;
}
int Find(int x) {
  if (p[x] == x) return x;
  return p[x] = Find(p[x]);
}
void Union(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x != y) {
    if (Size[x] < Size[y]) swap(x, y);
    p[y] = x;
    Size[x] += Size[y];
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) Create(i);
  for (int x, y, i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    Union(x, y);
  }
  for (int i = 0; i < n; i++)
    if (p[i] != i) Danger *= 2;
  printf("%I64d", Danger);
}
