N = int(input()) A = list(map(int, input().split())) for i in range(65): for j in range(N): if (A[j] >> i) & 1: break else: print(1 << i) exit()