n=int(input()) a=list(map(int,input().split())) c=[[0,0] for i in range(31)] for i in a: t=bin(i)[2:][::-1] for j in range(len(t)): c[j][int(t[j])] += 1 ans ='' for i,j in c: if i == 0 and j == 0: break if i > j: ans+='0' else: ans+='1' ans=int(ans[::-1],2) A=0 for i in a: A=max(i^ans,A) print(A)