#include <bits/stdc++.h>
using namespace std;
int main(){
	int array[1000001];
	array[1]=1;
	for(int i=2;i<=1000000;i++){
		int k=i;
		bool f=false;
		while(1){
			if(k%2==0)k/=2;
			else if(k%3==0)k/=3;
			else if(k%5==0)k/=5;
			else break;
			if(k==1){
				f=true;break;
			}
		}
		if(f)array[i]=array[i-1]+1;
		else array[i]=array[i-1];
	}
	int a,b;
	while(cin>>a>>b,a){
		cout<<array[b]-array[a-1]<<endl;
	}
}