#include <bits/stdc++.h>
using namespace std;
int fa[52];
int main() {
  int n, m, tx, ty;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    fa[i] = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> tx >> ty;
    while (fa[tx] != tx) tx = fa[tx];
    while (fa[ty] != ty) ty = fa[ty];
    fa[tx] = ty;
  }
  long long sum = 1LL << n;
  for (int i = 1; i <= n; i++)
    if (fa[i] == i) sum /= 2;
  cout << sum << endl;
  return 0;
}
