#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int a[1000010]={0};
bool flag[1000010]={false};
void hamming(){
	a[1]=1;
	flag[1]=true;
	for(int i=2;i <=1000000;i++){
		if(i%2==0&&flag[i/2])flag[i]=true;
		if(i%3==0&&flag[i/3])flag[i]=true;
		if(i%5==0&&flag[i/5])flag[i]=true;
		if(flag[i]){
			a[i]=(a[i-1]+1);
		}else{
			a[i]=a[i-1];
		}
	}
	return ;
}
int main(){
	hamming();
	int n,m;
	while(cin>>n>>m,n){
		cout <<a[m]-a[n-1]<<endl;
	}
	return 0;
}