#include <bits/stdc++.h>
using namespace std;
int x, y;
string s[169];
int par[100069];
int parent(int x) {
  if (x == par[x]) return x;
  return par[x] = parent(par[x]);
}
int main() {
  scanf("%d", &x), scanf("%d", &y);
  for (int i = 0; i < x; i++) par[i] = i;
  for (int i = 0; i < y; i++) {
    int a, b;
    cin >> a >> b;
    int pa = parent(a);
    int push_back = parent(b);
    if (pa != push_back) par[pa] = push_back;
  }
  int ans = x;
  for (int i = 0; i < x; i++) {
    if (i == par[i]) ans--;
  }
  cout << (1ll << ans);
  return 0;
}
