#include <bits/stdc++.h>
using namespace std;
vector<int> A[55];
int vis[60];
void dfs(int s) {
  vis[s] = 1;
  for (int i = 0; i < A[s].size(); i++) {
    int x = A[s][i];
    if (!vis[x]) {
      dfs(x);
    }
  }
}
int main() {
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    A[x].push_back(y);
    A[y].push_back(x);
  }
  int v = 0;
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i);
      v++;
    }
  }
  cout << (long long int)pow(2, n - v) << endl;
  return 0;
}
