#arc139a. [arc139_a]Trailing Zeros
[arc139_a]Trailing Zeros
Problem Statement
For a positive integer , let be the number of trailing zeros in the binary representation of .
For example, we have because the binary representation of is 1000
, and because the binary representation of is 101
.
You are given a sequence of non-negative integers .
Consider making a sequence of positive integers of your choice so that it satisfies the following conditions.
- holds. In other words, is strictly increasing.
- holds for every integer such that .
What is the minimum possible value of here?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
0 1 3 2
Sample Output 1
12
For example, satisfy the conditions.
cannot be or less, so the answer is .
Sample Input 2
5
4 3 2 1 0
Sample Output 2
31
Sample Input 3
1
40
Sample Output 3
1099511627776
Note that the answer may not fit into a -bit integer.
Sample Input 4
8
2 0 2 2 0 4 2 4
Sample Output 4
80