One day Colin learned how to represent a number in binary form. For example, the binary form of 10_{10}10 is 2_{2}2 , and he was very excited!Further, Eva taught Colin a well-known binary function lowbittext{lowbit}lowbit which represents the value of the bit corresponding to the lowest 111 of xxx in binary form. For example, lowbit=1text{lowbit} = 1lowbit=1 , lowbit=4text{lowbit} = 4lowbit=4. Colin thought this function was amazing, so he thought of an interesting problem, and then it comes:. Given a binary form of a number xxx , you need to perform some operations on xxx.Each turn you can choose one of the following two operations:. x+=lowbitmathbf{x+=lowbit}x+=lowbit , which means adding the lowest bit of xxx to xxx. x=lowbitmathbf{x-=lowbit}x=lowbit , which means subtracting the lowest bit of xxx from xxx. Now Colin wants to know, what is the minimum number of operations required to turn xxx into 000?
One day Colin learned how to represent a number in binary form. For example, the binary form of (11)10(11)_{10}(11)10 is (1011)2(1011)_{2}(1011)2 , and he was very excited! Further, Eva taught Colin a well-known binary function lowbit(x)text{lowbit}(x)lowbit(x) which represents the value of the bit corresponding to the lowest 111 of xxx in binary form. For example, lowbit(11)=1text{lowbit}(11) = 1lowbit(11)=1 , lowbit(4)=4text{lowbit}(4) = 4lowbit(4)=4 Colin thought this function was amazing, so he thought of an interesting problem, and then it comes: Given a binary form of a number x(x≤2105)x(xle 2^{10^5})x(x≤2105) , you need to perform some operations on xxx. Each turn you can choose one of the following two operations: x+=lowbit(x)mathbf{x+=lowbit(x)}x+=lowbit(x) , which means adding the lowest bit of xxx to xxx x−=lowbit(x)mathbf{x-=lowbit(x)}x−=lowbit(x) , which means subtracting the lowest bit of xxx from xxx Now Colin wants to know, what is the minimum number of operations required to turn xxx into 000?
