#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v;
vector<bool> vis;
unsigned long long dfs(int idx) {
  vis[idx] = true;
  unsigned long long res = 1;
  for (int i = 0; i < v[idx].size(); i++) {
    if (!vis[v[idx][i]]) res *= (dfs(v[idx][i]) * 2);
  }
  return res;
}
int main() {
  int n, m, x, y;
  cin >> n >> m;
  v.resize(n, vector<int>(n));
  vis.resize(n, false);
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--, y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  unsigned long long res = 1;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) res *= dfs(i);
  }
  cout << res << endl;
  return 0;
}
