import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): def dfs(): if sum(used)==n:return 0 i=used.index(False) used[i]=True res=0 for j in range(i+1,n): if used[j]:continue used[j]=True ret=dfs() ret+=aa[i]^aa[j] if ret>res:res=ret used[j]=False used[i]=False return res n=II() aa=LI() used=[False]*n print(dfs()) main()