#include <bits/stdc++.h>
using namespace std;
int pa[10086];
int find(int x) { return x == pa[x] ? pa[x] : pa[x] = find(pa[x]); }
int main() {
  int n, m, cnt = 0;
  long long res = 1;
  scanf("%d%d", &n, &m);
  for (int i = 0; i <= n; i++) pa[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    pa[find(a)] = pa[find(b)];
  }
  for (int i = 0; i <= n; i++)
    if (pa[i] != i) res *= 2;
  ;
  printf("%I64d", res);
  return 0;
}
