from itertools import combinations, permutations from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N = int(input()) A = tuple(map(int, input().split())) ans = 0 num = list(range(N)) for n1 in combinations(num, N // 2): m = set(num) - set(n1) for n2 in permutations(m, N // 2): power = 0 for i, j in zip(n1, n2): power += A[i] ^ A[j] ans = max(ans, power) print(ans) main()