#include <bits/stdc++.h>
using namespace std;
void dfs(vector<int> v[], bool visited[], int i);
long long sum = 1;
int main() {
  int n, p;
  cin >> n;
  bool visited[n + 1];
  memset(visited, false, sizeof(visited));
  ;
  vector<int> v[n + 1];
  cin >> p;
  for (int i = 0; i < p; i++) {
    int p1, p2;
    cin >> p1 >> p2;
    v[p1].push_back(p2);
    v[p2].push_back(p1);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) dfs(v, visited, i);
  }
  cout << sum << endl;
}
void dfs(vector<int> v[], bool visited[], int i) {
  visited[i] = true;
  for (int j = 0; j < v[i].size(); j++) {
    if (!visited[v[i][j]]) {
      sum = sum * 2;
      dfs(v, visited, v[i][j]);
    }
  }
}
