N = int(input()) lsA = list(map(int,input().split())) k = 0 for i in range(N): k |= lsA[i] k ^= 2**90-1 bn = bin(k) ind = 1 for i in range(1,90): if bn[-i] == '1': ind = i break print(2**(ind-1))