import itertools N = int(input()) first = input() binary_list=[] split_first = first.split() cnt=round(N/2) word_list1=list(itertools.combinations(split_first,2)) word_list2=list(itertools.combinations(word_list1,cnt)) for i in word_list2: chk_list=[] binary=0 for j in i: binary+=int((bin(int(j[0])^int(j[1]))),2) for k in j: chk_list.append(k) if len(chk_list) == len(set(chk_list)): binary_list.append(binary) print(max(binary_list))