def main(): _ = int(input()) arr = list(map(int, input().split())) for i in range(70): ans = 2 ** i if all(a & ans == 0 for a in arr): exit(print(ans)) if __name__ == "__main__": main()