#include <bits/stdc++.h>
using namespace std;
int check(vector<bool> s, int n) {
  for (int i = (1); i < (n + 1); i++) {
    if (s[i]) return i;
  }
  return 0;
}
int main() {
  int n, m;
  vector<vector<int> > c(51, vector<int>());
  vector<bool> s(51, true);
  scanf("%d %d", &n, &m);
  for (int i = (0); i < (m); i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    c[x].push_back(y);
    c[y].push_back(x);
  }
  int cc = 0;
  while (check(s, n)) {
    int x = check(s, n);
    queue<int> q;
    q.push(x);
    cc++;
    while (!q.empty()) {
      int z = q.front();
      q.pop();
      s[z] = false;
      for (int i = 0; i < c[z].size(); ++i) {
        x = c[z][i];
        if (s[x]) q.push(x);
      }
    }
  }
  cout << (long long)(pow(2, n - cc));
}
