import Control.Applicative ((<$>))
import Data.List (iterate)

breakNum :: Int -> Int
breakNum n = last twoList'
  where
    twoList  = take 7 $ iterate (*2) 1
    twoList' = filter (<=n) twoList

main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  
  putStrLn $ show $ breakNum n
