#include <bits/stdc++.h>
using namespace std;
void DFS(int s);
vector<int> v[60];
int d = 0;
int c[200];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i <= 50; i++) v[i].clear();
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= m; i++) {
    int u, vv;
    scanf("%d %d", &u, &vv);
    v[u].push_back(vv);
    v[vv].push_back(u);
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    if (c[i] == 0) {
      d = 0;
      DFS(i);
      mx = mx + d - 1;
    }
  }
  printf("%I64d\n", (long long)pow(2, mx));
  return 0;
}
void DFS(int s) {
  d++;
  c[s] = 1;
  int sz = v[s].size();
  for (int i = 0; i < sz; i++) {
    int x = v[s][i];
    if (c[x] == 0) {
      DFS(x);
    }
  }
}
