from itertools import combinations def solve(N, A): dp = [-float("inf")] * (1 << N) dp[0] = 0 for V in range(1 << N): for i, j in combinations(range(N), 2): ai = A[i] aj = A[j] if not ((V >> i) & 1) and not ((V >> j) & 1): VV = V | (1 << i) | (1 << j) dp[VV] = max(dp[VV], dp[V] + (ai ^ aj)) return dp[-1] def main(): N = int(input()) A = list(map(int, input().split())) ans = solve(N, A) print(ans) if __name__ == "__main__": main()