import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)

solve :: Int -> Int -> Int
solve c n
    | c * 2 > n = c
    | otherwise = solve (c * 2) n

main :: IO ()
main = do
    n <- fst . fromJust . BS.readInt <$> BS.getLine
    print $ solve 1 n
