#include <bits/stdc++.h>
using namespace std;
class UF {
 private:
  int* id;
  int* rank;
  int count;

 public:
  UF(int N) {
    count = N;
    id = new int[N];
    rank = new int[N];
    for (int i = 0; i < N; i++) {
      id[i] = i;
      rank[i] = 0;
    }
  }
  ~UF() {
    delete[] id;
    delete[] rank;
  }
  int find(int p) {
    while (p != id[p]) {
      id[p] = id[id[p]];
      p = id[p];
    }
    return p;
  }
  int getCount() { return count; }
  bool connected(int p, int q) { return find(p) == find(q); }
  void connect(int p, int q) {
    int i = find(p);
    int j = find(q);
    if (i == j) return;
    if (rank[i] < rank[j])
      id[i] = j;
    else if (rank[i] > rank[j])
      id[j] = i;
    else {
      id[j] = i;
      rank[i]++;
    }
    count--;
  }
};
int main() {
  int n, e;
  cin >> n >> e;
  UF uf(n);
  for (int i = 0; i < e; i++) {
    int v, w;
    cin >> v >> w;
    uf.connect(v - 1, w - 1);
  }
  int edges = n - uf.getCount();
  long long sum = 1;
  for (int i = 1; i <= edges; i++) {
    sum *= 2;
  }
  cout << sum << endl;
  return 0;
}
