n_max = 1012500
hs = []
rec = lambda do |x, i|
  break unless x <= n_max
  hs << x
  while i < 3
    rec[x * [2, 3, 5][i], i]
    i += 1
  end
end
rec[1, 0]
hs.sort!
loop do
  m, n = gets.split.map(&:to_i)
  break if m.zero?
  i, j = [m, n+1].map do |x|
    hs.bsearch_index {|h| x <= h }
  end
  p j - i
end