#include<queue>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

bool bh[1000001];

int main()
{
	priority_queue< int,vector<int>,greater<int> > pq;
	pq.push(1);	bh[1]=true;
	while(pq.top()<1000000){
		int a=pq.top();	pq.pop();
		if(2*a<=1000000&&!bh[2*a])	pq.push(2*a),bh[2*a]=true;
		if(3*a<=1000000&&!bh[3*a])	pq.push(3*a),bh[3*a]=true;
		if(5*a<=1000000&&!bh[5*a])	pq.push(5*a),bh[5*a]=true;
	}

	vector<int> ham;
	for(int i=0;i<=1000000;i++)	if(bh[i])	ham.push_back(i);

	for(int m,n;scanf("%d%d",&m,&n),m;){
		printf("%d\n",
			distance(lower_bound(ham.begin(),ham.end(),m),
					 upper_bound(ham.begin(),ham.end(),n))
		);
	}

	return 0;
}