#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 50;
int n, m, cnt, p[MAXN + 5], x, y;
int findS(int a) { return (p[a] == a) ? a : (p[a] = findS(p[a])); }
void unionS(int a, int b) {
  if (rand() % 2) swap(a, b);
  int x = findS(a), y = findS(b);
  if (x != y) {
    --cnt;
    p[x] = y;
  }
}
long long powmod(int a) {
  if (a == 0) return 1LL;
  if (a == 1) return 2LL;
  long long x = powmod(a / 2);
  return x * x * powmod(a % 2);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) p[i] = i;
  cnt = n;
  for (int i = 0; i < m; ++i) {
    cin >> x >> y;
    unionS(x, y);
  }
  cout << powmod(n - cnt) << '\n';
}
