#include using namespace std; int main() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector dp(1 << N); for (int i = 1; i < (1 << N); i++) { if (__builtin_popcount(i) & 1) continue; for (int j = 0; j < N; j++) if (i & (1 << j)) { for (int k = j + 1; k < N; k++) if (i & (1 << k)) { int t = i - (1 << j) - (1 << k); dp[i] = max(dp[i], dp[t] + (A[j] ^ A[k])); } } } cout << dp.back() << endl; return 0; }