import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

readInt = fst . fromJust . BS.readInt
getInt = readInt <$> BS.getLine

main = do
    x <- getInt
    print $ solve x
    
solve x = head [n | n <- [x..], check n]

check p = [()| n <-  [1..p] , p `mod` n == 0] == []
