#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, i, m, root;
  int marke[100000];
  long long danger = 1;
  cin >> n >> m;
  vector<int> v[n + 1];
  queue<int> dq;
  memset(marke, -1, sizeof(int) * (n + 1));
  while (m--) {
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (marke[i] == -1) {
      dq.push(i);
      while (!dq.empty()) {
        root = dq.front();
        marke[root] = 1;
        dq.pop();
        for (int j = 0; j < v[root].size(); j++) {
          if (marke[v[root][j]] == -1) {
            danger = danger * 2;
            marke[v[root][j]] = 1;
            dq.push(v[root][j]);
          }
        }
      }
    }
  }
  cout << danger << endl;
  return 0;
}
