import Data.List
import Control.Applicative
import Prelude
import Data.Char


main = do
  s  <-  read  <$> getLine
  putStrLn( show $ solve s)
  


solve :: Int -> Int
solve x = length [[a] | r<-[1..10^7],
                   s<-[1..10^7],
                   [a]<-drop s $take r [10^7,10^7-1..],
                   (sum $ map(digit)[a])==x]

digit :: Integral a => a -> Int
digit  = length . show 