from sys import stdin n, *a = map(int, stdin.read().split()) appearbit = [0 for i in range(63)] for i in range(n): for j in range(63): if a[i] & 1: appearbit[j] = appearbit[j] | 1 a[i] = a[i] >> 1 for i in range(63): if appearbit[i] == 0: ans = 1 << i print("{}".format(ans)) exit() ans = 1 << 63 print("{}".format(ans))