#include int main(void) { long long int N; long long int sumno, sumskill; scanf("%lld", &N); sumskill = 2 * N; sumno = N; while (N != 0) { N /= 2; sumno += N; } printf("%lld", sumskill - sumno); return 0; }