N = int(input()) A = list(map(int, input().split())) N2 = 1 << N inf = 10 ** 18 dp = [-inf] * N2 dp[0] = 0 for s in range(N2): for a in range(N): for b in range(a + 1, N): if (s >> a) & 1: continue if (s >> b) & 1: continue ns = s | (1 << a) | (1 << b) dp[ns] = max(dp[ns], dp[s] + (A[a] ^ A[b])) print(dp[-1])