#include using namespace std; signed main() { ios::sync_with_stdio(false); int N; cin >> N; vector A(N); for (int i = 0; i < N; ++i) cin >> A[i]; vector dp(1 << N); for (int s = 0; s + 1 < 1 << N; ++s) { if (__builtin_popcount(s) & 1) continue; int l = __builtin_ctz(~s); for (int i = 0; i < N; ++i) if (~s >> i & 1) if (i != l) dp[s | 1 << l | 1 << i] = max(dp[s | 1 << l | 1 << i], dp[s] + (A[l] ^ A[i])); } cout << dp.back() << endl; return 0; }