import math N = int(input()) A = list(map(int,input().split())) print(2**(int(math.log2(max(A)))+1))