N = int(input()) A = tuple(map(int, input().split())) bit_count = lambda b: bin(b).count("1") dp = [0] * (1 << N) for b in range(1 << N): if bit_count(b) % 2: continue for i in range(N): if (b >> i) & 1: continue for j in range(i + 1, N): if (b >> j) & 1: continue c = b | (1 << i) | (1 << j) dp[c] = max(dp[c], dp[b] + (A[i] ^ A[j])) print(dp[-1])