#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
    vector<bool> haming(1e6+1,false);
    queue<int> q;
    q.push(1);
    int x[] = {2,3,5};
    while(!q.empty()){
	int now = q.front();
	//cout<<now<<endl;
	q.pop();
	if(now > 1e6)continue;
	if(haming[now]) continue;
	haming[now] = true;
	for(int i=0;i<3;i++) q.push( now*x[i]);
    }
  //  cout<<"ok"<<endl;
    vector<int> cnt(1e6+1,0);
    for(int i=1;i<1e6+1;i++){
	int tmp = 0;
	if(haming[i] ) tmp++;
	cnt[i] = cnt[i-1] + tmp;
    }
    while(1){
	int n,m;
	cin>>n;
	if(n==0)break;
	cin>>m;
	cout<<cnt[m]-cnt[n-1]<<endl;
    }

	return 0;
}

