h = {}
primes = [2, 3, 5]
position = [0, 0, 0]
numbers = [1]
n_numbers = Array.new(1_000_001, 0)
n_numbers[1] = 1
while numbers.last < 1_000_000
	primes.each_with_index{|prime, i| position[i] += 1 while h[numbers[position[i]] * prime]}
	min = [numbers[position[0]] * primes[0], numbers[position[1]] * primes[1], numbers[position[2]] * primes[2]].min
	numbers << min
	h[min] = true
	n_numbers[min] = 1
end
1.upto(1_000_000){|i| n_numbers[i] += n_numbers[i - 1]}

while true
    m, n = gets.chomp.split.map(&:to_i)
    break if m == 0
    puts n_numbers[n] - n_numbers[m - 1]
end
