import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.Char

readInt = readLn :: IO Int
readInts = map read . words <$> getLine :: IO [Int]
cond t f c = if c then t else f
-- end of templete

f n = length . filter (==n) . foldr (<*>) [0..9] . flip replicate fs $ 3
  where
    fs = map (+) [0..9]

main = map read . words <$> getContents >>= mapM_ (print . f)