#include using namespace std; using ll = long long; int main() { ll N; cin >> N; vector A(N), dp(1LL << N, 0); for (ll i = 0; i < N; i++) cin >> A[i]; for (ll bit = 0; bit < (1LL << N); bit++) { for (ll i = 0; i < N; i++) { for (ll j = i + 1; j < N; j++) { if (!(bit & (1LL << i)) && !(bit & (1LL << j))) { dp[bit + (1 << i) + (1 << j)] = max(dp[bit] + (A[i] ^ A[j]), dp[bit + (1 << i) + (1 << j)]); } } } } cout << dp[(1 << N) - 1] << endl; }