Guess the number P65166


Statement
 

pdf   zip

thehtml

Ana and Bernardo pass the time as follows: First, Ana choose a secret number x between 1 and n. Afterwards, Bernardo conjectures which is that x. If he guesses, the game ends. If he is wrong, Ana tells him if x is greater or less than the number that Bernardo has conjectured. Bernardo tries again, receiving the answer of Ana, as many times as it is necessary until he guesses.

Your task is to write a program that, for each number n given, computes the maximal number of conjectures that Bernardo must do to guess the secret number, supposing that Bernardo plays the possible most cunning way.

Input

The input consists of a sequence of numbers between one and one million.

Output

For each given number, your program must print a line with the maximal number of conjectures that Bernardo must do to guess the secret number.

Public test cases
  • Input

    1
    2
    7
    8
    1000000
    

    Output

    1
    2
    3
    4
    20
    
  • Input

    
            
                                

    Output

    
            
                                
  • Input

    524288
    524287
    524289
    524286
    

    Output

    20
    19
    20
    19
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Spanish
    Other languages
    Spanish
    Official solutions
    C++
    User solutions
    C++ Python Ruby