#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
const long long int L = 3e3 + 5;
vector<long long int> adj[L];
vector<long long int> visited(55, 0);
long long int cnt = 0;
void dfs(long long int s) {
  visited[s] = true;
  cnt++;
  for (auto i : adj[s]) {
    if (!visited[i]) {
      dfs(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  long long int ans = 1;
  for (long long int i = 1; i <= n; i++) {
    cnt = 0;
    if (!visited[i]) {
      dfs(i);
      ans *= (1LL << (cnt - 1));
    }
  }
  cout << ans << "\n";
  return 0;
}
