#include <bits/stdc++.h>

using namespace std;

using ll = long long;

ll dp[1 << 14];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i + 1 < (1 << n); i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) continue;
            for (int k = j + 1; k < n; k++) {
                if (i & (1 << k)) continue;
                dp[(i | (1 << j)) | (1 << k)] = max(dp[(i | (1 << j)) | (1 << k)], dp[i] + (a[j] ^ a[k]));
            }
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}