#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long int a, long long int b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b = b >> 1;
  }
  return ans;
}
template <typename T>
T Min(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
T Max(T a, T b) {
  return a > b ? a : b;
}
void dfs(int u, vector<bool> &vis, vector<vector<int> > &g) {
  if (vis[u]) return;
  vis[u] = 1;
  for (auto t : g[u]) dfs(t, vis, g);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int> > g(n + 1);
  int a, b;
  for (int i = 0; i < (m); ++i) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  long long int p = 0;
  long long int ans = 1;
  vector<bool> vis(n + 1, 0);
  for (int i = 0; i < (n); ++i) {
    if (!vis[i + 1]) {
      dfs(i + 1, vis, g);
      long long int q = 0;
      for (int j = 0; j < (n); ++j)
        if (vis[j + 1]) q++;
      p = q - p;
      for (int j = 0; j < (p - 1); ++j) ans *= 2l;
      p = q;
    }
  }
  cout << ans << '\n';
  return 0;
}
