N = int(input()) A = tuple(map(int, input().split())) for i in range(60): for a in A: if (a >> i) & 1: break else: print(1 << i) exit()