Pseudo-dichotomic search

Consider a hidden vector VV with nn integer numbers in strictly increasing order. Given an integer xx that belongs to VV, you will play a game to guess the position jj where V[j]=xV[j] = x. You have to use a “black box” BB, with parameters xx and a position ii inside VV. If there is a j{i1,i,i+1}j \in \{i - 1, i, i + 1 \} such that V[j]=xV[j] = x, you win the game. Otherwise, BB will tell you whether x<V[i1]x < V[i-1] or x>V[i+1]x > V[i+1].

Given nn, what is the minimum number of calls to BB to win the game?

Input

Input consists of several cases, each one with an nn between 1 and 101810^{18}.

Output

For every nn, print the worst-case number of calls to BB to win the game, assuming a strategy that minimizes that worst-case cost.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:06:03.181Z

© Jutge.org, 2006–2026.
https://jutge.org