#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const long long MAX = 5100000; const long long INF = 1LL << 60; const long long mod = 1000000007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; vector> dp; ll N; vector a; ll dfs(ll S, ll pre) { if (pre != -1 && dp[S][pre] != -1) { return dp[S][pre]; } if (S == (1LL << N) - 1) return 0; ll res = 0; ll cnt = 0; for (ll i = 0; i < N; i++) { if ((S >> i) & 1) cnt++; } for (ll i = 0; i < N; i++) { if (!((S >> i) & 1)) { if (cnt & 1) { chmax(res, dfs((S + (1LL << i)), i) + (a[i] ^ a[pre])); } else chmax(res, dfs((S + (1LL << i)), i)); } } if (pre == -1) return res; else return dp[S][pre] = res; } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ scanf("%lld", &N); a.resize(N); for (ll i = 0; i < N; i++) scanf("%lld", &a[i]); dp = vector>(1 << N, vector(N, -1)); cout << dfs(0, -1) << endl; return 0; }