F. William and Cards
time limit per test
7.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

William likes to play card games. In this particular game, William is dealt a row of $$$N$$$ playing cards. Each of the cards has a positive integer point value, where the $$$i$$$-th card in the row has a point value of $$$p_i$$$.

The object of the card game is to minimize the maximum point value among all of the cards that William has. To do so, William is allowed to perform operations. For any $$$1 \leq i < N$$$, William may halve $$$p_i$$$ and double $$$p_{i-1}$$$ so long as $$$p_i$$$ is an even number. William may perform as many operations as he desires.

If William performs operations optimally, can you figure out the minimum maximum point value that he can achieve?

Input

The input will begin with a line containing a single integer $$$N\ (1 \leq N \leq 10^5)$$$. The next line will contain $$$N$$$ space-separated integers $$$p_0, \dots, p_{N-1}\ (1 \leq p_i \leq 10^9)$$$, the initial point values of the $$$N$$$ playing cards that William is dealt.

Output

The output should consist of a single integer representing the minimum maximum point value among all of the cards William is dealt assuming that he performs optimal operations.

Example
Input
5
1 25 36 80 12
Output
25