#!/usr/bin/env python3 import sys def main(): N = int(input()) A = list(map(int, input().split())) nums = [True] * 65 # import math # # print(math.log2(max(A))) # # print(10 ** 18) # # print(2 ** 60) # # print(2 ** 60 > 10 ** 18) for aa in A: for i in range(65): if aa >> i & 1: nums[i] = False for i, f in enumerate(nums): if f: print(2 ** i) return if __name__ == '__main__': main()