#!/usr/bin/python # -*- coding: utf-8 -*- # import from sys import stdin, setrecursionlimit setrecursionlimit(10**8) def int_map(): return map(int,input().split()) def int_list(): return list(map(int,input().split())) def int_mtx(N): x = [list(map(int, stdin.readline().split())) for _ in range(N)] return x def str_mtx(N): x = [list(stdin.readline()[:-1]) for _ in range(N)] return x def print_space(l): return print(" ".join([str(x) for x in l])) """ main code """ N = int(input()) A = int_list() dp = [0 for _ in range(2**N)] for s in range(2**N): for u in range(N): for v in range(u+1,N): if s >> u & 1 == 0 and s >> v & 1 == 0: dp[s+2**u+2**v] = max(dp[s+2**u+2**v], dp[s] + (A[u]^A[v])) print(dp[2**N-1])