#include using namespace std; using ull = unsigned long long; using ll = long long; int main() { ull N; cin >> N; ull tmp = N; ull sum = 0; while(N != 0) { sum += N/2; N /= 2; } cout << tmp - sum << endl; }