from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): global A, Ret n = int(input()) A = tuple(map(int, input().split())) Ret = [] fp(n) ans = 0 for x in Ret: pwr = 0 for i, j in x: pwr += A[i] ^ A[j] ans = max(ans, pwr) print(ans) def fp(n, d=0, dd=0, idx=0): nh = n // 2 if not d: d = [0] * nh if not dd: dd = [0] * n if idx == n: pair = [[] for _ in [0] * nh] for i in range(n): pair[dd[i]].append(i) Ret.append(pair) return for i in range(nh): if d[i] == 0: d[i] = 1 dd[idx] = i fp(n, d, dd, idx + 1) d[i] = 0 break for i in range(nh): if d[i] == 1: d[i] = 2 dd[idx] = i fp(n, d, dd, idx + 1) d[i] = 1 main()