#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int r, i;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long int power(long long int x, long long int y) {
  long long int temp, ty, my;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  ty = (temp) * (temp);
  if (y % 2 == 0) {
    return ty;
  } else {
    my = (x) * (ty);
    return my;
  }
}
long long int cn;
int visited[100];
vector<int> abhishek[100];
void dfs(int i) {
  if (visited[i] == 1)
    return;
  else {
    cn++;
    visited[i] = 1;
    for (vector<int>::iterator it = abhishek[i].begin();
         it != abhishek[i].end(); it++) {
      if (visited[*it] == 0) dfs(*it);
    }
    return;
  }
}
int main() {
  int t, i, j, n, m, k, p, a, b;
  long long int arr[70], ans = 1;
  cin >> n;
  cin >> m;
  while (m--) {
    cin >> a;
    cin >> b;
    abhishek[a].push_back(b);
    abhishek[b].push_back(a);
  }
  int ii = 0;
  for (i = 0; i < 100; i++) visited[i] = 0;
  for (i = 1; i <= n; i++) {
    if (visited[i] == 0) {
      cn = 0;
      dfs(i);
      arr[ii] = cn;
      ii++;
    }
  }
  if (m != 0) {
    for (i = 0; i < ii; i++) ans = ans * power(2, arr[i] - 1);
    cout << ans << "\n";
  } else if (m == 0)
    cout << "1\n";
  return 0;
}
