#include int main() { long N; scanf("%ld", &N); int total = N * 2; do { total -= N; N /= 2; } while( N != 0 ); printf("%ld\n", total); return 0; }