#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
const int MOD = 1000000007;
const int MAXN = 100005;
vector<vector<int> > g;
int k;
vector<int> u;
void dfs(int v) {
  u[v] = 1;
  k++;
  for (int i = 0; i < g[v].size(); ++i)
    if (!u[g[v][i]]) dfs(g[v][i]);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  g.resize(n);
  u.resize(n);
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y), g[y].push_back(x);
  }
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    if (u[i]) continue;
    k = 0;
    dfs(i);
    for (int j = 0; j < k - 1; ++j) ans *= 2;
  }
  cout << ans;
  return 0;
}
