#K95862. Maximum Level Determination

    ID: 38958 Type: Default 1000ms 256MiB

Maximum Level Determination

Maximum Level Determination

You are given a non-negative integer x representing the total XP (experience points) a player has accumulated. The player starts at level 1. To advance from level \(L-1\) to level \(L\) for \(L \geq 2\), the required XP is \(2^{L-2}\). In other words, the total XP needed to reach level \(L\) is

\[ S(L) = \sum_{i=2}^{L} 2^{i-2} \leq x \]

Your task is to determine the maximum level a player can reach given the total XP \(x\). Note that if x is exactly equal to the boundary requirement for a level up, the player will be at the previous level.

Example:

  • If x = 0, the player remains at level 1.
  • If x = 1, the player can reach level 2 since \(2^0 = 1\).
  • If x = 2, the player only manages level 2 (not enough XP for level 3).

inputFormat

The input is read from standard input (stdin) and consists of a single non-negative integer x representing the total XP.

outputFormat

Output to standard output (stdout) a single integer representing the maximum level the player can achieve with the given XP.

## sample
0
1