n = int(input()) ans = 0 t = 0 for x in map(int, input().split()): t |= x i = 0 while (t >> i) & 1: i += 1 print(pow(2, i))