#include<bits/stdc++.h>
using namespace std;
int ans, n;
vector<int> v(1);
bitset<2005> vis;
void dfs(int x, int tot, int res){
if(tot == n){
ans = max(ans, res);
return;
}for(int i = 1; i <= n; ++i){
if(x and !vis[i]){
vis.set(i);
dfs(x, tot + 1, res + (v[x] ^ v[i]));
dfs(i, tot + 1, res + (v[x] ^ v[i]));
vis.reset(i);
}else if(!x){
vis.set(i);
dfs(i, 1, 0);
vis.reset(i);
}
}return;
}signed main(){
scanf("%d", &n);
for(int i = 1; i <= n; ++i){
int k;
scanf("%d", &k);
v.push_back(k);
}dfs(0, 0, 0);
printf("%d", ans);
return 0;
}