import Control.Monad import Control.Applicative main :: IO () main = do n <- read <$> getLine :: IO Integer print $ head $ do x <- [3..] guard $ n `mod` x == 0 return x