#include using namespace std; using i64 = long long; #define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++) int N; vector A; i64 dp[1 << 15]; int main(){ cin >> N; A.resize(N); rep(i,0,N - 1){ cin >> A[i]; } rep(i,0,(1 << 15) - 1){ dp[i] = -1e9; } dp[0] = 0; for(int s = 1;s < (1 << N);s++){ if(__builtin_popcount(s) % 2 == 1) continue; for(int i = 0;i < N;i++){ for(int j = 0;j < N;j++){ if(i == j) continue; if(!(s & (1 << i))) continue; if(!(s & (1 << j))) continue; int t = s; t = t & ~(1 << i); t = t & ~(1 << j); dp[s] = max(dp[s],dp[t] + (A[i] ^ A[j])); } } } cout << dp[(1 << N) - 1] << endl; }