#include <bits/stdc++.h>
using namespace std;
bool mas[50][50];
int main() {
  long long int n, m, res = 0;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    mas[x][y] = mas[y][x] = true;
  }
  bool used[50] = {};
  for (int i = 0; i < n; i++)
    if (!used[i]) {
      int count = -1;
      queue<int> q;
      used[i] = true;
      q.push(i);
      while (!q.empty()) {
        count++;
        int a = q.front();
        q.pop();
        for (int b = 0; b < n; b++)
          if (!used[b] && mas[a][b]) {
            used[b] = true;
            q.push(b);
          }
      }
      res += count;
    }
  long long int res2 = 1;
  for (int i = 0; i < res; i++) res2 *= 2;
  cout << res2;
}
