from sortedcontainers import SortedList def dfs(): global ans, sum0 if not S: ans = max(ans, sum0) return a = S.pop(0) for b in range(len(S)): c = S.pop(b) sum0 += A[a] ^ A[c] dfs() S.add(c) sum0 -= A[a] ^ A[c] S.add(a) N = int(input()) A = list(map(int, input().split())) S = SortedList(range(N)) ans = 0 sum0 = 0 dfs() print(ans)