#include <bits/stdc++.h>
using namespace std;
vector<int> a[52];
bool visited[52];
int cnt = 0;
long long p(int a, int b) {
  long long ans = 1;
  for (int i = 1; i <= b; i++) ans = ans * a;
  return ans;
}
void dfs(int v) {
  cnt++;
  visited[v] = true;
  for (auto u : a[v]) {
    if (visited[u] == false) dfs(u);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    cnt = 0;
    if (visited[i] == false) {
      dfs(i);
      ans = ans * p(2, cnt - 1);
    }
  }
  cout << ans;
}
