import Data.List (elemIndex)
import Data.Maybe (fromJust)

main :: IO ()
main = do
  n <- readLn :: IO Int
  let d = map (\x -> f x 0) [1..n]
  print $ [1..n] !! fromJust (elemIndex (maximum d) d)

f :: Int -> Int -> Int
f n i
  |odd n = i
  |odd $ n`div`2 = i + 1
  |otherwise = f (n `div` 2) (i+1)

