#include <bits/stdc++.h>
using namespace std;
vector<int> graph[1000];
int start, n, m;
long long int cnt;
bool visited[110];
int dfs(int prev, int current) {
  visited[current] = true;
  cnt++;
  int ret = 0;
  for (int i = 0; i < graph[current].size(); i++)
    if (!visited[graph[current][i]] && graph[current][i] != prev)
      ret = max(ret, dfs(current, graph[current][i]));
  return ret + 1;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  if (m == 0) {
    printf("1\n");
    return 0;
  }
  long long int maximum = 0LL, solution = 1LL;
  for (int i = 1; i <= n; i++) {
    if (visited[i]) continue;
    cnt = 0;
    start = i;
    dfs(i, i);
    if (cnt == 1) continue;
    long long int ret = 1;
    for (long long int j = 0; j < cnt - 1; j++) solution *= 2LL;
  }
  cout << solution << endl;
  return 0;
}
