n = int(input()) A = list(map(int, input().split())) ans = 1 while True: tot = 0 for a in A: tot |= (a & 1) if tot == 0: print(ans) break for i in range(n): A[i] >>= 1 ans <<= 1