import strutils, sequtils var n=stdin.readLine.parseInt a=stdin.readLine.split.map(parseInt) memo=newSeq[int](1 shl n) proc f(bit: int): int= if bit==(1 shl n)-1: memo[bit]=0 else: var ret=0 for i in 0..0: continue for j in 0..0: continue ret=max(ret, (a[i] xor a[j])+f(bit xor (1 shl i) xor (1 shl j))) memo[bit]=ret echo f(0)