import Data.List
import Data.Bits

toInt :: (String -> Int)
toInt x = read x ::Int

getInts :: IO [Int]
getInts = do
  x <- getLine
  let y = (map$toInt)$words x
  return y



solve :: Integer -> Integer
solve 0 = 0
solve h = 1 + shiftL(solve(shiftR h 1)) 1



main = do
  h <- readLn :: IO Integer
  putStrLn $ show (solve h)
