# frozen_string_literal: true

m, d = gets.chomp.split(' ').map(&:to_i)

count = 0

(2..m).each do |month|
  (10..d).each do |day|
    day_split = day.to_s.scan(/./).map(&:to_i)
    next if day_split.include?(1)

    day_mul = 1
    day_split.each do |i|
      day_mul *= i
    end

    count += 1 if day_mul == month
  end
end

print count
