#P7018. The Bus Passenger Problem

    ID: 20225 Type: Default 1000ms 256MiB

The Bus Passenger Problem

The Bus Passenger Problem

A bus with n passengers opens its door at a bus stop. At each stop, exactly half of the passengers plus half of a passenger get off. This process is repeated for k stops in total. It is given that after the last stop the bus is empty, and no one was hurt during the trip. Your task is to determine the initial number n of people on the bus.

Note: Despite the phrase "half of a passenger", the number of passengers at every step is an integer. You might find it useful to work backwards from the last stop.

Hint: If you denote the number of passengers before a stop as a, then after the stop the remaining passengers are (a - 1)/2. Use this recurrence to derive an expression for n in terms of k.

The answer can be expressed in closed form as:

\( n = 2^k - 1 \)

inputFormat

The input contains a single integer k (1 ≤ k ≤ 30), representing the number of stops.

outputFormat

Output a single integer, the initial number of passengers n on the bus.

sample

1
1