main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (m:d:_) = length . filter isSekisu $ candidates
  where
    isSekisu (month, day) = month == d1 * d10
      where
        d1 = day `mod` 10
        d10 = day `div` 10
    candidates = filter (\(_, day) -> (day `mod` 10) > 1) $ do
      month <- [1..m]
      day <- [22..d]
      return (month, day)