P2431 Pretty Girl Eats Mooncakes

Description

Today is the Mid-Autumn Festival. uim brought a bunch of mooncakes of different sizes and flavors. The masses of these mooncakes are $1g,2g,4g,8g,16g$... each one is twice the previous. There is exactly one of each kind. uim lets the pretty girl eat whatever she wants. She wants to try as many flavors as possible, so she will eat as many mooncakes as possible (by count, not by weight). Also, she is indeed a bit hungry; she needs to eat at least $A\text{g}$ in total to be satisfied. However, she is afraid of gaining weight, so the total amount of mooncakes she eats cannot exceed $B\text{g}$. She wants to know the maximum number of mooncakes she can eat.

Input Format

One line containing two numbers, $A,B$.

Output Format

Output the maximum number of mooncakes she can eat.

Explanation/Hint

Sample Explanation: She can eat $1,2,4,16$, which are $4$ mooncakes (there may be multiple ways). Constraints: For $30\%$ of the testdata, $1 \le A,B \le 1000$; For $60\%$ of the testdata, $1 \le A,B \le 100000$; For $100\%$ of the testdata, $1 \le A,B \le 2^{63}-1$. Translated by ChatGPT 5