#include <bits/stdc++.h>
using namespace std;
long long sol = 1, soll = 1, prod = 0, dp[55][55];
int cnt, nr, cost[55];
bool viz[55];
vector<int> L[55];
inline void Dfs(int nod) {
  ++cnt;
  viz[nod] = true;
  vector<int>::iterator it;
  for (it = L[nod].begin(); it != L[nod].end(); ++it)
    if (!viz[*it]) Dfs(*it);
}
int main() {
  int n, m, x, y, i, j;
  cin >> n >> m;
  while (m--) {
    scanf("%d%d", &x, &y);
    L[x].push_back(y);
    L[y].push_back(x);
  }
  for (i = 1; i <= n; ++i)
    if (!viz[i]) {
      cnt = 0;
      Dfs(i);
      sol *= (1LL << (cnt - 1));
    }
  if (!sol) ++sol;
  cout << sol << "\n";
  return 0;
}
