#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;

int n;
vector<vector<int>> to;
vector<int> used, col, vs;

void dfs(int v){
	if(used[v]) return;
  
  	used[v] = 1;
  	vs.push_back(v);
  	for(int u : to[v]) dfs(u);
}

ll now;
void dfs2(int i){
	if(i == vs.size()){now++; return;}
  
  	int v = vs[i];
  	rep(c, 3){
    	col[v] = c;	
      	bool ok = true;
      	for(int u : to[v]){
        	if(col[u] == c) ok = false;
        }
      	if(!ok) continue;
      	dfs2(i+1);
    }
  	col[v] = -1;
}

int main(){
	int m;
  	cin >> n >> m;
  	to = vector<vector<int>> (n);
  	rep(i, m){
    	int a, b;
      	cin >> a >> b;
     	a--; b--; 
     
      	to[a].push_back(b);
        to[b].push_back(a);
    }
  
  	ll ans = 1;
  	used = vector<int> (n);
  	col = vector<int> (n, -1);
  
  	rep(i, n){
    	if(used[i]) continue;
      
      	ans *= 3;
      	vs = vector<int> ();
      	dfs(i);
      	col[vs[0]] = 0;
      	now = 0;
      	dfs2(1);
      	ans *= now;
    }
  
  	cout << ans << endl;
}
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; debug_print(__VA_ARGS__); } while(false)
template<typename T, typename... Ts> void debug_print(const T &t, const Ts &...ts) { cerr << t; ((cerr << ", " << ts), ...); cerr << endl; }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, const T& b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, const T& b) { if (a < b) {a = b; return true; } return false; }
template<typename T, typename... Ts> void print(const T& t, const Ts&... ts) { cout << t; ((cout << ' ' << ts), ...); cout << '\n'; }
template<typename... Ts> void input(Ts&... ts) { (cin >> ... >> ts); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

class UnionFind {
public:
    vector<int> par;
    int N;
    UnionFind(int n) {
        par.resize(n, -1);
        N = n;
    }
    int Find(int n) {
        return par[n] < 0 ? n : par[n] = Find(par[n]);
    }
    bool Union(int x, int y) {
        x = Find(x);
        y = Find(y);
        if (x == y) return false;
        if (-par[x] > -par[y]) swap(x, y);
        par[y] += par[x];
        par[x] = y;
        N--;
        return true;
    }
    bool Same(int x, int y) {
        return Find(x) == Find(y);
    }
    int size(int x) {
        return -par[Find(x)];
    }
    int size() {
        return N;
    }
};

int popcount(ll bits) {
    bits = (bits & 0x5555555555555555LL) + (bits >> 1 & 0x5555555555555555LL);
    bits = (bits & 0x3333333333333333LL) + (bits >> 2 & 0x3333333333333333LL);
    bits = (bits & 0x0f0f0f0f0f0f0f0fLL) + (bits >> 4 & 0x0f0f0f0f0f0f0f0fLL);
    bits = (bits & 0x00ff00ff00ff00ffLL) + (bits >> 8 & 0x00ff00ff00ff00ffLL);
    bits = (bits & 0x0000ffff0000ffffLL) + (bits >> 16 & 0x0000ffff0000ffffLL);
    return (bits & 0x00000000ffffffffLL) + (bits >> 32 & 0x00000000ffffffffLL);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    input(n, m);
    vector<P> edge(m);
    vector<ll> pow2(30, 1);
    rep(i, 1, 30) {
        pow2[i] = pow2[i - 1] * 2;
    }
    rep(i, 0, m) {
        int a, b;
        input(a, b);
        a--;
        b--;
        edge[i] = P(a, b);
    }
    int bits = 1 << n;
    ll ans = 0;
    rep(bit, 0, bits) {
        vector<bool> used(n, 0);
        rep(i, 0, n) {
            if ((bit >> i) & 1) {
                used[i] = true;
            }
        }
        UnionFind uf(2 * n), uf2(n);
        bool ok = true;
        for (auto [a, b] : edge) {
            if (used[a] && used[b]) {
                ok = false;
            } else if (used[a] || used[b]) {
                continue;
            } else {
                uf.Union(a, b + n);
                uf.Union(a + n, b);
                uf2.Union(a, b);
            }
        }
        for (auto [a, b] : edge) {
            if (!used[a] && !used[b]) {
                if (uf.Same(a + n, b + n)) {
                    ok = false;
                    break;
                }
            }
        }
        if (ok) {
            ans += pow2[uf2.size() - popcount(bit)];
        }
    }
    print(ans);
    return 0;
}
