n=int(input()) a=list(map(int,input().split())) rank=0 for j in range(60,-1,-1): idx=-1 for i in range(rank,n): if a[i]&(1<