#include <bits/stdc++.h>
using namespace std;
long long ans = 1;
int p[59], cnt[59];
int n, m, x, y;
int getpa(int x) { return p[x] == x ? x : p[x] = getpa(p[x]); }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    if (getpa(x) != getpa(y)) p[getpa(x)] = getpa(y);
  }
  for (int i = 1; i <= n; i++) cnt[getpa(i)]++;
  for (int i = 1; i <= n; i++)
    if (cnt[i] >= 2) ans *= 1LL << (cnt[i] - 1);
  printf("%I64d\n", ans);
  return 0;
}
