N, *A = map(int, open(0).read().split()) x = 0 for a in A: x |= a for i in range(x.bit_length()): if (1 << i) and x != 0: continue print(1 << i)