#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, m;
vector<vector<int>> g;
vector<bool> used;
long long ans = 1LL;
void dfs(int from) {
  used[from] = true;
  const vector<int>& cur = g[from];
  for (int i = 0; i < cur.size(); ++i) {
    if (!used[cur[i]]) {
      ans *= 2;
      dfs(cur[i]);
    }
  }
}
int main() {
  cin >> n >> m;
  g.resize(n);
  used.resize(n);
  for (int i = 0; i < m; ++i) {
    int from, to;
    cin >> from >> to;
    --from, --to;
    g[from].push_back(to);
    g[to].push_back(from);
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i] && !g[i].empty()) {
      dfs(i);
    }
  }
  cout << ans;
  return 0;
}
