#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> v[51];
int vis[51] = {0};
int dfs(int i) {
  vis[i] = 1;
  for (int j = 0; j < v[i].size(); j++) {
    if (vis[v[i][j]] != 1) {
      dfs(v[i][j]);
    }
  }
  return 0;
}
long long bin_pow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      count++;
      dfs(i);
    }
  }
  if (count) {
    cout << bin_pow(2, n - count);
  } else {
    cout << "0";
  }
}
