#include using namespace std; int main(){ unsigned long long N, normal=0, skill=0; cin >> N; while(N > 0){ if(skill < normal+N*2) skill = normal+N*2; normal += N; N /= 2; } cout << skill - normal << endl; return 0; }