function main() n = parse(BigInt, readline()) x = n * 2 y = big"0" while n > 0 y += n # n รท= 2 n >>= 1 end println(x - y) end main()