import Data.List

count x = loop x
  where
    loop a
      | mod a 2 == 1 = 0
      | otherwise = 1 + loop (div a 2) 

main = do
  n <- readLn :: IO Int
  print $ snd $ maximum $ map (\x -> (count x, x)) [1..n]