N = int(input()) A = list(map(int, input().split())) a = A[0] for i in range(1, N): a |= A[i] cnt = 0 while (1 << cnt) & a: cnt += 1 print(1 << cnt)