from functools import reduce from operator import or_ def main(): N = int(input()) A = list(map(int, input().split())) A_sum = reduce(or_, A) X = 1 while A_sum & X: X = (X << 1) print(X) if __name__ == "__main__": main()