N=int(input()) #N,A,B=map(int,input().split()) A=list(map(int, input().split())) ans=0 for i in range(30): D=[] for a in A: if (a&(1<