N = int(input()) A = list(map(int, input().split())) sums = 0 for a in A: sums = sums | a for i in range(65): if not sums >> i & 1: print(2**i) break