module Main where

import           Control.Monad
import           Debug.Trace
import qualified Data.Vector.Unboxed           as VU
import           Data.List
import qualified Data.ByteString               as BS
import qualified Data.ByteString.Char8         as BSC8
import           Data.Char
import           Data.Maybe
import qualified Data.Text                     as T
tuplify2 (x : y : _) = (x, y)
tuplify2 _           = undefined

getVUIntFromInputLineAtBSC8 :: IO (VU.Vector Int)
getVUIntFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine
getVUIntListFromInputLineAtBSC8 =
    VU.unfoldr (BSC8.readInt . BSC8.dropWhile isSpace) <$> BSC8.getLine

readInt = fst . fromJust . BSC8.readInt
readIntTuple = tuplify2 . map readInt . BSC8.words
readIntList = map readInt . BSC8.words

getInt = readInt <$> BSC8.getLine
getIntList = readIntList <$> BSC8.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BSC8.getLine
getIntMatrix = map readIntList . BSC8.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BSC8.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BSC8.getLine
getIntTuples = map readIntTuple . BSC8.lines <$> BSC8.getContents

main :: IO ()
main = do

    aN <- getInt

    print $ getK aN

getK n= length (nub((getBaiBaiK n) ++ (getkakekakeK n)))+2

getBaiBaiK n = 
        let ret = getBaiBaiK' n [2..] 
        in if ret==0
            then [] 
            else [ret]

getBaiBaiK' n (x:xs) = 
    if (mod n x == 0) 
        then 
            if getBaiBaiK'' n x 
                then x 
                else 0 
        else getBaiBaiK' n xs 

getBaiBaiK'' n x = 
    if x*x > n 
        then False
        else 
            if mod n x == 0 
                then getBaiBaiK'' (div n x) x
                else False 

getkakekakeK :: Int-> [Int]
getkakekakeK n = 
    let ret' = (getkakekakeK' (n-1) [2..] [])
        ret1 = ret'
        boolList = (map (\x-> getkakekakeK'' n x) ret1)
        ret2 = foldl (\acc x@(y1,y2) -> if y1 then acc ++ [y2] else acc) [] (zip  boolList ret1)
    in 
        --trace (show ret1 ++ show ret2 ++ show boolList)  
        ret1++ret2
getkakekakeK' :: Int->[Int]->[Int]->[Int]
getkakekakeK' n (x:xs) ys = 
    --trace ("n:"++(show n)++"x:"++(show x)++"ys:"++(show ys))$
    if (x * x) > n 
        then ys ++ [n]
        else
            if mod n x == 0 
                then let newYs = if x*x == n then ys++[x] else ys++[x]++[(div n x)]
                     in getkakekakeK' n xs newYs  
                else getkakekakeK' n xs ys 

getkakekakeK'' :: Int->Int->Bool
getkakekakeK'' n x = if mod ((warerumadewaru) n x - 1) x == 0 then True else False

warerumadewaru n x = if mod n x == 0 then warerumadewaru (div n x) x else n


