#include using namespace std; using ll = long long; const int mod = 1e9 + 7; const int inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; #define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define digit(N) cout << fixed << setprecision((N)) int N; int main() { cin >> N; vector dp(1 << N), a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } for (int bit = 0; bit < (1 << N); bit++) { for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { if (!(bit & (1 << i)) && !(bit & (1 << j))) { dp[bit + (1 << i) + (1 << j)] = max(dp[bit + (1 << i) + (1 << j)], dp[bit] + (a[i] ^ a[j])); } } } } cout << dp[(1 << N) - 1] << "\n"; }