#C8864. Tree Height Calculation

    ID: 52893 Type: Default 1000ms 256MiB

Tree Height Calculation

Tree Height Calculation

Given an integer n representing the number of days, calculate the height of a tree after n days. The tree's initial height is 1 meter. The tree's growth follows these rules:

  • On odd-numbered days, the tree's height increases by 1 meter. That is, if the height on day \(i-1\) is \(h_{i-1}\), then on an odd day \(h_i = h_{i-1} + 1\).
  • On even-numbered days, the tree's height doubles. That is, on an even day \(h_i = 2 \times h_{i-1}\).

In summary, starting from \(h_0 = 1\), for each day \(i\) (\(1 \leq i \leq n\)) the following recurrence holds:

\(h_i = \begin{cases}h_{i-1} + 1, & \text{if } i \text{ is odd}\\ 2 \times h_{i-1}, & \text{if } i \text{ is even}\end{cases}\)

Your task is to compute and output the height of the tree after n days.

inputFormat

The input consists of a single integer n (\(1 \leq n \leq 10^4\) for instance), provided via standard input. The integer represents the number of days.

outputFormat

Output a single integer representing the tree's height after n days, printed to standard output.

## sample
1
2

</p>