N = int(input())
A = list(map(int,input().split()))

import sys
sys.setrecursiojnlimit(10 ** 8)

_max = 0
def calc(S = 0,now = 0):
    global _max
    
    if S == (1 << N) - 1:
        if now > _max:
            _max = now
        return
    for j in range(N):
        maskj = 1<< j
        if S & maskj == 0:
            index = j
            break
    b = S ^ maskj
    for u in range(N):
        masku = 1 << u
        if b & masku == 0:
            calc(b ^ masku,now ^ (A[index] + A[u]))
calc()
print(_max)