from functools import reduce input() x = reduce(int.__or__, map(int, input().split()), 0) for ans in range(100): if x >> ans & 1 == 0: break print(1 << ans)