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: #include <bits/stdc++.h>
using namespace std;

int main() {
    long long n,ans=0;
    cin>>n; n++;
    for(long long i=0;i<=45;i++) {
        if(n<=(1LL<<i)) break;
        long long x = (n/(1LL<<i));
        long long ones=(x>>1LL)*(1LL<<i)+(x%2?(n%(1LL<<i)):0);
        ans+=min(n-1-ones,ones);
    }
    
    cout<<ans;
    
    
    return 0;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?