#include <bits/stdc++.h>
using namespace std;
bool used[101];
int a[101][101];
int n;
int k;
void dfs(int v) {
  if (!used[v]) k++;
  used[v] = true;
  for (int i = 0; i < n; i++)
    if (a[v][i] && !used[i]) dfs(i);
}
int main() {
  long long ans = 1;
  int m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    a[x][y] = 1;
    a[y][x] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      k = 0;
      dfs(i);
      for (int j = 0; j < k - 1; j++) ans *= 2;
    }
  }
  cout << ans;
  return 0;
}
