mx = 1000000
haming = {1=>1}
mem = [1]

while mem != []
	nextmem = []
	mem.each {|h|
		[2,3,5].map {|x|x*h}.each{|h2|
			if h2 <= mx and !haming[h2]
				nextmem.push h2
				haming[h2] = 1
			end
		}
	}
	mem = nextmem
end
haming = haming.keys
while gets.split.map(&:to_i)!=[0]
	m,n = $_.split.map(&:to_i)
	puts haming.count {|x|
		(m..n).member? x
	}
end