main :: IO () main = do n <- read `fmap` getLine let f 0 = 0 f x = x + f (x `div` 2) print $ n * 2 - f n