AtCoder Regular Contest 139
A
Trailing Zeros
AtCoder
⌀ 599
原题
←B →
翻译中…

Problem Statement

翻译中…

For a positive integer $x$, let $\mathrm{ctz}(x)$ be the number of trailing zeros in the binary representation of $x$. For example, we have $\mathrm{ctz}(8)=3$ because the binary representation of $8$ is 1000, and $\mathrm{ctz}(5)=0$ because the binary representation of $5$ is 101.

翻译中…

You are given a sequence of non-negative integers $T = (T_1,T_2,\dots,T_N)$. Consider making a sequence of positive integers $A = (A_1, A_2, \dots, A_N)$ of your choice so that it satisfies the following conditions.

翻译中…
  • $A_1 \lt A_2 \lt \cdots \lt A_{N-1} \lt A_N$ holds. In other words, $A$ is strictly increasing.
  • $\mathrm{ctz}(A_i) = T_i$ holds for every integer $i$ such that $1 \leq i \leq N$.
翻译中…

What is the minimum possible value of $A_N$ here?

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^5$
  • $0 \leq T_i \leq 40$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
T_1 T_2 \dots T_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4
0 1 3 2
Output #1
12
For example, $A_1=3,A_2=6,A_3=8,A_4=12$ satisfy the conditions. $A_4$ cannot be $11$ or less, so the answer is $12$.
Input #2
5
4 3 2 1 0
Output #2
31
Input #3
1
40
Output #3
1099511627776
Note that the answer may not fit into a $32$-bit integer.
Input #4
8
2 0 2 2 0 4 2 4
Output #4
80
题目信息
题号
arc139_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。