#include <bits/stdc++.h>
using namespace std;
long long int dsu[55], s[55] = {0}, x, y, n, m, Ti = 1;
long long int finddsu(long long int u) {
  if (u == dsu[u])
    return u;
  else
    return dsu[u] = finddsu(dsu[u]);
}
void uniondsu(long long int u, long long int v) {
  long long int a = finddsu(u);
  long long int b = finddsu(v);
  if (a == v || b == u || a == b) return;
  if (s[a] >= s[b])
    dsu[b] = a, s[a] += s[b], s[b] = 0;
  else
    dsu[a] = b, s[b] += s[a], s[a] = 0;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) dsu[i] = i, s[i] = 1;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    uniondsu(x, y);
  }
  for (int i = 1; i <= n; i++) {
    if (s[i] <= 1) continue;
    for (int j = 2; j <= s[i]; j++) Ti *= 2;
  }
  cout << Ti << endl;
  return 0;
}
