For this Question: Sara has N numbers (from 1 to N), she wishes to make all the numbers equal. For a number X, she can either unset any set bit or set any unset bit in the binary representation of X in exchange for 1 coin. 
Sara wants to know the minimum number of coins to make all the numbers equal help her to find it.Input contains a single line containing the value of N.

<b>Constraints:- </b>
1 <= N <= 10<sup>12</sup>Print a single integer containing minimum coinsSample Input:-
4

Sample Output:-
5

Explanation:-
1 = 001 = 011 = 1 coin
2 = 010 = 011 = 1 coin
3 = 011 = 011 = 0 coin
4 = 100 = 011 = 3 coin
Total = 5

Sample Input:-
2

Sample Output:-
2, I have written this Solution Code: n=int(input())
arr=[]
ans=0
t=n
while n>0:
    arr=[n%2]+arr
    n//=2
r=1
t+=1
for i in reversed(arr):
    ans+=((t//r)//2)*r
    if (t//r)%2!=0:
        ans+=t%r
    r*=2
for i in reversed(arr):
    if i==1:
        ans-=1
    else:
        break
print(ans), In this Programming Language: Python, Now tell me if this Code is compilable or not?