#include <bits/stdc++.h>
using namespace std;
void dfs(bool* visit, vector<int>* am, int n, int sv, vector<int>& v) {
  visit[sv] = true;
  v.push_back(sv);
  for (int p = 0; p < am[sv].size(); ++p) {
    if (visit[am[sv][p]] == false) {
      dfs(visit, am, n, am[sv][p], v);
    }
  }
  return;
}
int main() {
  int n, m;
  cin >> n >> m;
  int* arr = new int[n];
  vector<int>* graph = new vector<int>[n];
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    graph[a - 1].push_back(b - 1);
    graph[b - 1].push_back(a - 1);
  }
  bool* visit = new bool[n]();
  long long count = 1;
  for (int cur = 0; cur < n; ++cur) {
    if (visit[cur] == false) {
      vector<int> v;
      dfs(visit, graph, n, cur, v);
      int p = v.size() - 1;
      for (int j = 1; j <= p; ++j) {
        count = count * 2;
      }
    }
  }
  cout << count << endl;
}
