#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long mxn = 55;
;
vector<long long> adj[mxn];
vector<bool> visited(mxn);
long long cnt;
void dfs(long long x) {
  cnt++;
  visited[x] = 1;
  for (auto i : adj[x]) {
    if (!visited[i]) {
      dfs(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (!visited[i]) {
      dfs(i);
      cnt--;
    }
  }
  ans += pow(2, (cnt));
  cout << ans << '\n';
}
