N = int(input()) A = list(map(int, input().split())) def pop_count(T): T = (T & 0x55555555) + ((T >> 1) & 0x55555555) T = (T & 0x33333333) + ((T >> 2) & 0x33333333) T = (T & 0x0F0F0F0F) + ((T >> 4) & 0x0F0F0F0F) T = (T & 0x00FF00FF) + ((T >> 8) & 0x00FF00FF) T = (T & 0x0000FFFF) + ((T >> 16) & 0x0000FFFF) return T dp = [0] * (1 << N) for S in range(1 << N): if pop_count(S) % 2 == 1: continue for i in range(N - 1): if ~(S >> i) & 1: for j in range(i + 1, N): if ~(S >> j) & 1: U = S ^ (1 << i) ^ (1 << j) if dp[U] < dp[S] + (A[i] ^ A[j]): dp[U] = dp[S] + (A[i] ^ A[j]) print(dp[(1 << N)-1])