import itertools N = int(input()) A = list(map(int,input().split())) C = list(itertools.combinations(range(N), N//2)) ans = 0 for c in C: r = list(range(N)) for i in c: r.remove(i) P = list(itertools.permutations(r)) for p in P: power=0 for i in range(N//2): power+=A[c[i]]^A[p[i]] ans = max(power,ans) print(ans)