#include <bits/stdc++.h>
using namespace std;
ifstream f("cf.in");
int n, m, c[100], nr, a, b;
vector<vector<int> > lv;
void citire() {
  cin >> n >> m;
  lv.resize(n + 1);
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    lv[a].push_back(b);
    lv[b].push_back(a);
  }
}
int cnt = 0;
void DF(int x) {
  c[x] = 1;
  cnt++;
  vector<int>::iterator it;
  for (it = lv[x].begin(); it != lv[x].end(); ++it)
    if (!c[*it]) DF(*it);
}
int main() {
  citire();
  for (int i = 1; i <= n; i++)
    if (!c[i]) nr++, DF(i);
  cout << (1LL << (n - nr)) << '\n';
  return 0;
}
