#include <bits/stdc++.h>
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
using namespace std;
const int N = 2e5 + 5;
int par[N], r[N];
int find(int a) {
  if (par[a] < 0)
    return a;
  else
    return (par[a] = find(par[a]));
}
void merge(int a, int b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  if (r[a] > r[b]) {
    par[b] = a;
    r[a] += r[b];
  } else {
    par[a] = b;
    r[b] += r[a];
  }
}
void solve() {
  int n, m, i, j;
  cin >> n >> m;
  for (i = 1; i < n + 1; i++) par[i] = -1, r[i] = 1;
  for (i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    merge(a, b);
  }
  long long int ans = 1;
  for (i = 1; i < n + 1; i++) {
    if (r[i] > 1 && par[i] < 0) ans = ans * pow(2, r[i] - 1);
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
