Sweets for mushrooms
Easy
Execution time limit is 3 seconds
Runtime memory usage limit is 128 megabytes
It seems strange, but mushrooms like soda. Moreover, Michael likes to make experiments with it. Each kind of soda has it's own level of sweetness. Michael has n containers with soda of different levels. If Michael mix two containers with levels x and y, instead of these two he will get soda with level 2 * min(x,y).
Help Michael to get soda with the highest possible level of sweetness.
Input
The first line contains the number of containers n (1 ≤ n ≤ 10^6
). The second line contains n integers: the level of sweetness x[i]
(-10^9
≤ x[i]
≤ 10^9
).
Output
Print the highest possible level of sweetness that can be obtained by mixing some of the available sodas.
Examples
Input #1
Answer #1
Input #16
Answer #16
Submissions 3K
Acceptance rate 22%