#include <bits/stdc++.h>
using namespace std;
const int N = 51;
int p[N], s[N];
void init() {
  for (int i = 0; i < N; i++) p[i] = i, s[i] = 1;
}
int find(int x) { return p[x] == x ? x : p[x] = find(p[x]); }
void dsu(int x, int y) {
  x = find(x), y = find(y);
  if (s[x] < s[y])
    p[x] = y, s[y] += s[x];
  else
    p[y] = x, s[x] += s[y];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, x, y;
  set<int> ch;
  init();
  cin >> n >> m;
  while (m--) cin >> x >> y, dsu(x, y);
  for (int i = 0; i < n; i++) ch.insert(find(i + 1));
  n -= ch.size();
  cout << (1LL << n);
  return 0;
}
