#include <bits/stdc++.h>
using namespace std;
void ff() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
void in_out_txt() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
vector<vector<int>> adj(51);
int co;
int mark[51];
void dfs(int node) {
  if (mark[node]) return;
  mark[node] = 1;
  co++;
  for (int i = 0; i < adj[node].size(); i++) {
    dfs(adj[node][i]);
  }
}
long long power2(int num) {
  long long sum = 1;
  for (int i = 0; i < num / 2; i++) sum *= 2;
  if (num % 2 != 0) return sum * sum * 2;
  return sum * sum;
}
int main() {
  ff();
  int n, m;
  cin >> n >> m;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  co = 0;
  long long mx = 0;
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 0) {
      co = 0;
      dfs(i);
      if (co != 1) mx += co - 1;
    }
  }
  cout << power2(mx) << endl;
  ;
  return 0;
}
