N = int(input()) B = [0 for i in range(70)] A = list(map(int,input().split())) for i in range(N): for j in range(70): if A[i] & 2**j: B[j] = 1 for i in range(70): if B[i] == 0: print(2**i) exit()