m,d = gets.split.map(&:to_i)
ans = 0
(2..m).each do |i|
    (22..d).each do |j|
        next if j%10 < 2
        if i == j.to_s.split("").map(&:to_i).inject(:*)
            ans += 1
        end
    end
end
puts ans