Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/qidiruv-sonni-topish-oyini

Guess the number

Easy 1000 ms 128 MB 23%
Share

Ali has thought of one of the numbers from $1$ to $n$ — the number $x$. Vali finds it as follows. At first the search range is $[l; r] = [1; n]$. Each time Vali names the middle number of the range $m = \lfloor (l + r) / 2 \rfloor$: if $m = x$, the game ends; if $m \lt x$, the range becomes $[m + 1; r]$, and if $m \gt x$, it becomes $[l; m - 1]$. How many numbers does Vali name in total?

A row of numbers from 1 to n: the named numbers are marked in order, the hidden one is highlighted

Input

One line with two positive integers: $n$ and $x$.

Output

One positive integer — the number of named numbers.

Note

$1 \le x \le n \le 10^{18}$

Examples

Input #1
10 7
Output #1
4
Input #2
1 1
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.