#include <bits/stdc++.h>
using namespace std;
int s[100];
int val[100];
int Find(int x) { return x == s[x] ? x : Find(s[x]); }
void make(int a, int b) {
  int x = Find(a);
  int y = Find(b);
  if (x == y) return;
  if (val[x] > val[y]) {
    val[x]++;
    s[y] = x;
  } else {
    val[y]++;
    s[x] = y;
  }
}
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i <= n; i++) s[i] = i, val[i] = 0;
    for (int i = 0; i < m; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      make(a, b);
    }
    int num[55];
    memset(num, 0, sizeof(num));
    long long ans = 1;
    for (int i = 1; i <= n; i++) {
      if (val[i]) {
        ans *= pow(2, val[i]);
      }
    }
    cout << ans << endl;
  }
}
