#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
#pragma GCC diagnostic ignored "-Wsign-compare"
int find(int first, vector<int>& par) {
  if (first != par[first]) return find(par[first], par);
  return first;
}
bool same(int first, int second, vector<int>& par) {
  return find(first, par) == find(second, par);
}
void merge(int first, int second, vector<int>& par) {
  first = find(first, par);
  second = find(second, par);
  if (same(first, second, par)) return;
  par[second] = first;
  42;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int m;
  cin >> m;
  vector<vector<int> > adj(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vector<int> par(n);
  iota(par.begin(), par.end(), 0);
  for (int i = 0; i < n; i++) {
    for (auto& first : adj[i]) {
      merge(i, first, par);
    }
  }
  map<int, int> cnt;
  int ret = 0;
  for (int i = 0; i < n; i++) {
    if (!cnt[find(i, par)]) ret++;
    cnt[find(i, par)]++;
  }
  long long pr = 1;
  for (int i = 0; i < (n - ret); i++) {
    pr *= 2;
  }
  42;
  42;
  cout << pr << endl;
  return 0;
}
