import           Control.Applicative
import           Control.Monad
import           Data.List
import qualified Data.Vector                   as V

main :: IO ()
main = do
  n <- readLn
  print $ last $ n : [ 2 ^ i | i <- [1 .. 34], n >= 2 ^ i ]