import Data.Char (digitToInt)

main :: IO ()
main = solve . map (read :: String -> Int) . words <$> getLine >>= print

f :: Int -> Int
f d | d1 > 1 && d2 > 1 = product $ map digitToInt $ show d
    | otherwise        = 0
    where
        d1 = d `div` 10
        d2 = d `mod` 10

solve :: [Int] -> Int
solve [m, d] = length [0 | x <- [1..m], y <- [1..d], x == f y]