def hamming(n)
  [2,3,5].each{ |m| n /= m while (n%m).zero? } 
  return (n == 1 ? true : false)
end

loop do
  m, n = gets.split.map(&:to_i)
  break if m.zero?
  count = 0
  m.upto(n){|num| count += 1 if hamming(num) }
  puts count
end