#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> e[n];
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x;
    --y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  int ans = 0;
  vector<char> flag(n, false);
  for (int root = 0; root < n; ++root) {
    if (flag[root]) continue;
    queue<int> q;
    q.push(root);
    int k = 0;
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      flag[v] = true;
      ++k;
      for (int i = 0; i < e[v].size(); ++i) {
        int to = e[v][i];
        if (flag[to]) continue;
        flag[to] = true;
        q.push(to);
      }
    }
    ans += k - 1;
  }
  long long ANS = 1;
  while (ans--) ANS *= 2;
  printf("%I64d", ANS);
  exit(0);
}
