#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=25;
int color[maxn];
int n,m,a,b;
vector<int>v[maxn];
vector<int>node;
int vis[maxn];
void dfs(int s){
	vis[s]=1;
	node.push_back(s);
	for(int i=0;i<v[s].size();i++)
	if(!vis[v[s][i]]) dfs(v[s][i]);
}
ll cnt(int cur){
	if(cur==node.size()) return 1;         //相乘 则return值为1不为0 
	ll ans=0;
	for(int i=0;i<3;i++){
		int ve=node[cur],sign=0;
		for(int j=0;j<v[ve].size();j++){
			if(color[v[ve][j]]==i){
				sign=1;
				break;
			}
		}
		if(!sign){
			color[ve]=i;
			ans+=cnt(cur+1);
			color[ve]=-1;
		}
	}
	return ans; 
}
int main(){
	ios::sync_with_stdio(0);
	cin>>n>>m;
	memset(color,-1,sizeof color);
	memset(vis,0,sizeof vis);
	for(int i=0;i<m;i++){
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	ll res=1,k;
	for(int i=1;i<=n;i++){
		if(!vis[i]){
			node.clear();           //存当前可以到达的所有节点 
			dfs(i);
			k=cnt(0);
			res*=k;
		}
	}
	cout<<res<<endl;
	return 0;
}
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

ll modComb(ll n, ll k) {
    ll tmp = 1;
    for (int i = 0; i < k; i++) {
        tmp *= n - i;
        tmp %= MOD;
    }
    for (int i = 1; i <= k; i++) {
        tmp *= modInv(i);
        tmp %= MOD;
    }
    return tmp;
}

ll N;
vector<ll> A(30);
ll ans;

int main() {
    cin >> N;
    rep(i, N) cin >> A[i];

    rep(i, 1 << (N - 1)) {
        //iのnビット目がたってたらが区切り(たかだか100万回)
        ll ortmp = A[0], xortmp = 0;
        rep(j, N - 1) {
            if (!((i >> j) & 1)) {
                ortmp |= A[j + 1];
            }
            else {
                xortmp ^= ortmp;
                ortmp = A[j + 1];
            }
        }

        xortmp ^= ortmp;

        if (i == 0) ans = xortmp;
        else ans = min(ans, xortmp);
    }

    cout << ans << endl;
}