#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, m;
vector<int> adj[51];
int visited[51];
int BFS(int s) {
int cnt = 1;
queue<int> q;
q.push(s);
visited[s] = true;
while (!q.empty()) {
int u = q.front();
q.pop();
for (int v : adj[u]) {
if (!visited[v]) {
cnt += 1;
q.push(v);
visited[v] = true;
}
}
}
return cnt;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m;
int res = 1;
for (int i = 1, x, y; i <= m; i += 1) {
cin >> x >> y;
adj[x].push_back(y);
adj[y].push_back(x);
}
for (int i = 1; i <= n; i += 1) {
if (!visited[i]) {
int Size = BFS(i);
for (int k = 1; k < Size; k += 1) {
res *= 2;
}
}
}
cout << res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgaW50IGxvbmcgbG9uZwoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBuLCBtOwp2ZWN0b3I8aW50PiBhZGpbNTFdOwppbnQgdmlzaXRlZFs1MV07CgppbnQgQkZTKGludCBzKSB7CiAgICBpbnQgY250ID0gMTsKICAgIHF1ZXVlPGludD4gcTsKCiAgICBxLnB1c2gocyk7CiAgICB2aXNpdGVkW3NdID0gdHJ1ZTsKCiAgICB3aGlsZSAoIXEuZW1wdHkoKSkgewogICAgICAgIGludCB1ID0gcS5mcm9udCgpOwogICAgICAgIHEucG9wKCk7CgogICAgICAgIGZvciAoaW50IHYgOiBhZGpbdV0pIHsKICAgICAgICAgICAgaWYgKCF2aXNpdGVkW3ZdKSB7CiAgICAgICAgICAgICAgICBjbnQgKz0gMTsKICAgICAgICAgICAgICAgIHEucHVzaCh2KTsKICAgICAgICAgICAgICAgIHZpc2l0ZWRbdl0gPSB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIHJldHVybiBjbnQ7Cn0KCmludDMyX3QgbWFpbigpIHsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKCiAgICBjaW4gPj4gbiA+PiBtOwoKICAgIGludCByZXMgPSAxOwoKICAgIGZvciAoaW50IGkgPSAxLCB4LCB5OyBpIDw9IG07IGkgKz0gMSkgewogICAgICAgIGNpbiA+PiB4ID4+IHk7CiAgICAgICAgYWRqW3hdLnB1c2hfYmFjayh5KTsKICAgICAgICBhZGpbeV0ucHVzaF9iYWNrKHgpOwogICAgfQoKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkgKz0gMSkgewogICAgICAgIGlmICghdmlzaXRlZFtpXSkgewogICAgICAgICAgICBpbnQgU2l6ZSA9IEJGUyhpKTsKICAgICAgICAgICAgZm9yIChpbnQgayA9IDE7IGsgPCBTaXplOyBrICs9IDEpIHsKICAgICAgICAgICAgICAgIHJlcyAqPSAyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGNvdXQgPDwgcmVzOwoKICAgIHJldHVybiAwOwp9Cg==