N=int(input()) A=list(map(int,input().split())) M=(1<<63)-1 for i in range(N): M&=~A[i] print(M&-M)