#include <bits/stdc++.h>
const int MAX = 1e4 + 5;
using namespace std;
pair<long long int, pair<long long int, long long int> > vec[MAX];
vector<long long int> adj[200002];
long long int vis[200002];
long long int n, m, a, b, c = 1, k, ans = 1;
void dfs(long long int u) {
  vis[u] = 1;
  for (auto &i : adj[u]) {
    if (!vis[i]) {
      c = c * 2;
      dfs(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (long long int i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i);
    }
  }
  cout << c << endl;
  return 0;
}
