#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using R = double; using Data = pair < ll, vector >; const ll MOD = 1e9 + 7; const ll inf = 1LL << 60; struct edge { ll from; ll to; ll cost; }; typedef tupleT; typedef pairpll; #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(ll i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(ll i = m;i >= n;--i) #define INF INT_MAX/2 int N,A[20],memo[1<<14]; int rec(int msk){ if (memo[msk] != -1)return memo[msk]; if (msk == 0)return 0; int ret = 0; pairp = {-1,-1}; rep(i, 0, N)rep(j, i+1, N) { if ((1< ret) { ret = temp; p = { i,j }; } } } int t= A[p.first] ^ A[p.second]; return memo[msk] = ret + t; } int main(){ cin >> N; rep(i, 0, N)cin >> A[i]; memset(memo, -1, sizeof(memo)); cout << rec((1<