N = int(input()) A = list(map(int, input().split())) dp = [0] * (1 << N) for S in range(1 << N): for u in range(N-1): if S & (1 << u): continue for v in range(u+1, N): if S & (1 << v): continue dp[S | (1 << u) | (1 << v)] = max(dp[S | (1 << u) | (1 << v)], dp[S] + A[u] ^ A[v]) # print(dp) print(dp[-1])