#include <bits/stdc++.h>
using namespace std;
int num[60 << 2];
int finda(int x) { return num[x] != x ? num[x] = finda(num[x]) : x; }
void connect(int a, int b) {
  int n = finda(a);
  int m = finda(b);
  if (n != m) {
    num[n] = m;
  }
}
void init(int n) {
  for (int i = 1; i <= n; i++) {
    num[i] = i;
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  init(n);
  int ans = 0;
  if (m == 0) {
    printf("1\n");
    return 0;
  }
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    connect(a, b);
  }
  for (int i = 1; i <= n; i++) {
    if (num[i] != i) {
      ans++;
    }
  }
  long long sum = pow(2, ans);
  printf("%lld\n", sum);
  return 0;
}
