main = do
    n <- read <$> getLine
    print $ findPowerOf2 (reverse [1 .. n]) $ powerOf2 (n `div` 2)

powerOf2 :: Int -> [Int]
powerOf2 max = map (2^) [0 .. max]

findPowerOf2 :: [Int] -> [Int] -> Int
findPowerOf2 [n] _ = n
findPowerOf2 (x:xs) po2 = if x `elem` po2 then x else findPowerOf2 xs po2