favorite We need a little bit of your help to keep things running, click on this banner to learn more

Week 4: November 30 – December 6. While Loop. Part 1


Lets take some positive integer n. We shall change it nest way: if number is even, divide it by 2, if odd, add 1 to it. After several such changes we always get the number 1. For example, from number 11 we get 12, then 6, 3, 4, 2 and at last 1. So in order to get 1 from 11 we need to make 6 changes.

Given a positive integer, find the number of its changes to get 1.


One positive integer n (1n109).


Print the number of changes for n to get 1.

Time limit 1 second
Memory limit 128 MiB
Input example #1
Output example #1