#include <bits/stdc++.h>
using namespace std;
namespace uzumaki {}
using namespace uzumaki;
typedef std::priority_queue<long long int, std::vector<long long int>,
                            std::greater<long long int> >
    min_pq;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
namespace uzumaki {
template <typename T>
T max(T A) {
  return A;
}
template <typename T, typename... args>
T max(T A, T B, args... S) {
  return max(A > B ? A : B, S...);
}
template <typename T>
T min(T A) {
  return A;
}
template <typename T, typename... args>
T min(T A, T B, args... S) {
  return min(A < B ? A : B, S...);
}
template <typename T, typename U>
std::ostream& operator<<(std::ostream& out, std::pair<T, U> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename U>
std::istream& operator>>(std::istream& in, std::pair<T, U>& a) {
  in >> a.first >> a.second;
  return in;
}
inline string inttos(long long int a) {
  std::stringstream soso;
  soso << a;
  return soso.str();
}
inline long long int stoint(const std::string& s) {
  std::stringstream soso;
  soso << s;
  long long x;
  soso >> x;
  return x;
}
inline std::string inttobin(long long int x) {
  return std::bitset<40>(x).to_string();
}
inline void swp(long long int& a, long long int& b) {
  auto temp = a;
  a = b;
  b = temp;
}
}  // namespace uzumaki
const long long int N = 51;
long long int n, m;
long long int vis[52];
vector<long long int> graph[N];
void addedge(long long int a, long long int b) {
  graph[a].push_back(b);
  graph[b].push_back(a);
}
void dfs(long long int root) {
  vis[root] = 1;
  for (long long int i = 0; i < (long long int)graph[root].size(); i++) {
    if (vis[graph[root][i]] == 0) {
      vis[graph[root][i]] = 1;
      dfs(graph[root][i]);
    }
  }
}
long long int findssc() {
  long long int cnt = 0;
  for (long long int i = 1; i < n + 1; i++) {
    if (!vis[i]) {
      cnt++;
      dfs(i);
    }
  }
  return cnt;
}
void solve() {
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    addedge(x, y);
  }
  long long int ssc = findssc();
  long long int ans = 1;
  for (long long int i = 0; i < n - ssc; i++) {
    ans = ans * 2;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  for (long long int i = 0; i < t; i++) {
    solve();
  }
}
