#include <bits/stdc++.h>
using namespace std;
long long int visited[100001];
vector<long long int> adj[100001];
long long int sum = 0;
void dfs(long long int s) {
  if (visited[s] == 1) {
    return;
  }
  sum++;
  visited[s] = 1;
  for (auto u : adj[s]) {
    dfs(u);
  }
}
long long int binpow(long long int x, long long int n) {
  if (n == 0) return 1;
  long long u = binpow(x, n / 2);
  u = (u * u);
  if (n % 2 == 1) u = (u * x);
  return u;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  while (m--) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  memset(visited, 0, sizeof(visited));
  ;
  long long int ans = 1;
  for (long long int i = 1; i <= n; i++) {
    if (visited[i] == 0) {
      sum = 0;
      dfs(i);
      long long int y = sum - 1;
      long long int r = binpow(2, y);
      ans = ans * r;
    }
  }
  cout << ans << endl;
  return 0;
}
