#include <bits/stdc++.h>
using namespace std;
const int mx = 53;
vector<int> v[mx];
bool vis[mx];
long long int ans = 1;
void dfs(int i) {
  vis[i] = 1;
  for (int j = 0; j < v[i].size(); j++) {
    if (!vis[v[i][j]]) {
      ans *= 2;
      dfs(v[i][j]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  memset(vis, 0, sizeof vis);
  int i, j, k, n, m, x, y;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i);
  }
  cout << ans << endl;
  return 0;
}
