#include using namespace std; int main() { long long n, t, ans; cin >> n; ans=n; t=n; while (t) { t/=2; ans+=t; } cout << n*2-ans << endl; }