#include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[1000] = {0};
int used[1000] = {0};
int pairs[100000][2] = {0};
long long val = 1;
struct node {
  int vis;
  node() { vis = 0; }
  set<int> neigh;
};
node nodes[10000];
void DFS(int here) {
  for (int ne : nodes[here].neigh) {
    if (!nodes[ne].vis) {
      nodes[ne].vis = true;
      val *= 2;
      DFS(ne);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    nodes[a].neigh.insert(b);
    nodes[b].neigh.insert(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!nodes[i].vis) {
      nodes[i].vis = true;
      DFS(i);
    }
  }
  cout << val << endl;
  cin.get();
  cin.get();
  return 0;
}
