
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

main::IO()
main=do
  n <- fst . fromJust . BC.readInteger <$> BC.getLine
  print $ solve (bs n) n 0
   where
     bs::Integer->Integer
     bs=ceiling . (logBase 10 ) . fromIntegral
     solve::Integer->Integer->Integer->Integer
     solve base 0 ans=((ans -1) `div` 9) +1
     solve base val ans= solve (base-1) (val - t * x) (ans + t)
       where
         x=(10^base) `div` 9
         t= val `div` x
