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

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

main = do
  n <- getInt

  let solve i res | i*i >=    n    = res
                  | n `mod` i == 0 = solve (i+1) (res + (n-i) `div` i)
                  | otherwise      = solve (i+1) res

  print $ solve 1 0