eolymp
bolt
Try our new interface for solving problems
Problems

Sweets for mushrooms

Sweets for mushrooms

Time limit 3 seconds
Memory limit 128 MiB

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 data

The first line contains the number of containers n (1n10^6). The second line contains n integers: the level of sweetness x[i] (-10^9x[i]10^9).

Output data

Print the highest possible level of sweetness that can be obtained by mixing some of the available sodas.

Examples

Input example #1
3
1 3 6
Output example #1
6
Input example #16
4
5 8 10 19
Output example #16
38
Author Борис Соколов
Source Дистанционная Летняя Компьютерная Школа - лето 2013 года