#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll powermod(ll a,ll b,ll m){
	if(b==0){
		return 1LL;
	}
	if(b%2){
		return (a*powermod(a,b-1LL,m))%m;
	}
	return powermod((a*a)%m,b/2LL,m);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int K[3]={0,0,0};
	int P[3]={2,3,5};
	REP(i,3){
		int V=1000000;
		while(V){
			K[i]++;
			V /= P[i];
		}
	}
	vector<ll> H(1000001,0),S(1000002,0);
	for(int i=0;i<=K[0];i++){
		for(int j=0;j<=K[1];j++){
			for(int k=0;k<=K[2];k++){
				auto V = 1LL*powermod(2,i,atcoder_mod)*powermod(3,j,atcoder_mod)*powermod(5,k,atcoder_mod);
				if(V<=1000000LL){
					H[V]=1;
				}
			}
		}
	}
	for(int i=0;i<1000001;i++){
		S[i+1]=S[i]+H[i];
	}

	while(true){
		ll N=in();
		if(!N) break;

		ll M=in();

		out(S[M+1]-S[N]);
	}
	
	return 0;
}

