def search(x): j = 0 for i in range(N): if NU[i] == True: if j == x: return i j += 1 def dfs(x): global ans, sum0 if x == 0: ans = max(ans, sum0) return a = NU.index(True) NU[a] = False for b in range(a + 1,N): if True not in NU[b:]: continue c = NU[b:].index(True) + b NU[c] = False sum0 += A[a] ^ A[c] dfs(x - 1) sum0 -= A[a] ^ A[c] NU[c] = True NU[a] = True N = int(input()) A = list(map(int, input().split())) NU = [True] * N ans = 0 sum0 = 0 dfs(N//2) print(ans)