#include <bits/stdc++.h>
using namespace std;
const int MAX = 55;
int parent[MAX];
int n, m, t1, t2;
long long res = 1;
int findp(int x) {
  int root = x;
  while (parent[root] != root) {
    root = parent[root];
  }
  if (root != x) {
    parent[x] = root;
  }
  return root;
}
void join(int x, int y) {
  int px = findp(x);
  int py = findp(y);
  if (px != py) {
    parent[px] = py;
    res *= 2;
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) parent[i] = i;
  for (int i = 0; i < m; i++) {
    cin >> t1 >> t2;
    join(t1, t2);
  }
  cout << res;
  return 0;
}
