#include <bits/stdc++.h>
using namespace std;
const long long inf = 10000003;
long long n, m, k = 0, q;
vector<int> adj[55];
int vis[55];
long long POWER(long long x, long long y) {
  if (y == 0) return 1;
  if (y % 2 == 0) {
    long long temp = POWER(x, y / 2);
    temp *= temp;
    return temp;
  }
  long long temp = POWER(x, y - 1);
  temp *= x;
  return temp;
}
int main() {
  cin >> n >> m;
  int x, y;
  while (m--) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    int len = 0;
    if (!vis[i]) {
      queue<int> q;
      q.push(i);
      vis[i] = 1;
      while (q.size()) {
        int u = q.front();
        q.pop();
        for (auto x : adj[u]) {
          if (!vis[x]) {
            len++;
            vis[x] = 1;
            q.push(x);
          }
        }
      }
    }
    cnt += len;
  }
  cout << POWER(2, cnt) * 1LL;
  return 0;
}
