module Main where

import           Data.Maybe                     ( fromJust )
import           Data.List
import           Control.Monad
import qualified Data.ByteString.Char8         as BS
import qualified Data.Vector                   as VU

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


main :: IO ()
main = do
    n <- getInt
    print $ culc . VU.fromList $ divisor n


culc :: VU.Vector Int -> Int
culc v =
    (if l == 2
            then VU.sum v
            else if odd l then v VU.! lh * 2 else v VU.! (lh - 1) + v VU.! lh
        )
        - 2
  where
    l  = VU.length v
    lh = div l 2


primes :: Integral a => [a]
primes = map fromIntegral prime_c
  where
    prime_c = [2, 3, 5] ++ f 5 7 (drop 2 prime_c)
    f m s (p : ps) = [ n | n <- ns, gcd m n == 1 ] ++ f (m * p) (p * p) ps
        where ns = [ x + y | x <- [s, s + 6 .. p * p - 2], y <- [0, 4] ]

factorize :: Integral a => a -> [(a, Int)]
factorize 1 = [(1, 0)]
factorize n = format $ factorize_c n primes
  where
    format ps = [ (x, length xs) | xs@(x : _) <- group ps ]
    factorize_c n ps@(p : ps') | p * p > n    = [n]
                               | rem n p == 0 = p : factorize_c (div n p) ps
                               | otherwise    = factorize_c n ps'

divisor :: Integral a => a -> [a]
divisor n = sort $ foldr distribute [1] ns
  where
    ns = [ map (f ^) [0 .. i] | (f, i) <- factorize n ]
    distribute ns1 ns2 = [ x * y | x <- ns1, y <- ns2 ]

