Derrick is cultivating a garden of
Derrick wants to grow more Orz Trees in his garden, but he ran out of Orz Seedlings to plant. Fortunately, Orz Trees aren't like other trees. When an Orz Tree with even height is cut down, two Orz Trees with exactly half the height of the tree appear side-by-side in its place! Note that it is impossible to cut down an Orz Tree with odd height.
Derrick wants to know, after cutting down
Constraints
Subtask 1 [50%]
Subtask 2 [50%]
No additional constraints.
Input Specification
The first line contains an integer
The second line contains
Output Specification
Output a single integer, the number of distinct gardens Derrick can make by cutting down
Sample Input 1
3
6 5 2
Sample Output 1
4
Explanation for Sample Output 1
Derrick can choose to cut down the first and/or last Orz Trees, or to cut down nothing.
The
Sample Input 2
1
4
Sample Output 2
5
Explanation for Sample Output 2
If Derrick cuts down the tree of height
Comments