Kozak Vus and the Magical Boots
Friends of Cossack Vus have received a secret letter containing an ancient blueprint for magical boots. These boots enable the wearer to accelerate to incredible speeds, starting at an initial speed of meter per second.
When wearing these magical boots, if a person's current speed is meters per second, they can cast one of two spells:
Increase their speed by meters per second.
Increase their speed by meters per second.
Determine the minimum number of spells needed for a person in these magical boots to reach exactly meters per second.
Giriş verilənləri
The input consists of a single integer () — the target speed to be achieved.
It is guaranteed that reaching the specified speed is possible in a finite number of steps.
Çıxış verilənləri
Output a single integer — the minimum number of spells required to reach the target speed.
Nümunələr
Qeyd
In the first example, the initial speed is already , so no spells are needed.
In the second example, you can use the first type of spell to increase the speed by meter per second, reaching meters per second.
In the third example, you can apply the first spell, then the second spell, and finally the first spell again. The speed progression will be: . It can be demonstrated that fewer spells are insufficient to achieve this speed.