#include <bits/stdc++.h>
using namespace std;
long long used[1000];
long long ans = 1;
vector<vector<long long> > g(1000);
void dfs(int v, int p = -1) {
  used[v] = 1;
  if (p != -1) {
    ans *= 2;
  }
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (!used[to]) {
      dfs(to, v);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i < n + 1; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  cout << ans;
  return 0;
}
