n = int(input()) alst = list(map(int, input().split())) x = 0 for a in alst: x |= a i = 0 while x >> i & 1: i += 1 print(1 << i)