#include <iostream>
#include <algorithm>
using namespace std;

int hamming[1000000+1];
bool is_hamming[1000000+1];

int make_ham(int n)
{
	for(int i=0;i<n;i++){
		is_hamming[i] = false;
	}
	is_hamming[1] = true;
	for(int i=1;i<n;i*=2){
		is_hamming[i] = true;
		for(int j=i;j<n;j*=3){
			is_hamming[j] = true;
			for(int k=j;k<n;k*=5){
				is_hamming[k] = true;
			}
		}
		for(int j=i;j<n;j*=5){
			is_hamming[j] = true;
		}
	}
	int h = 0;
	for(int i=0;i<n;i++){
		if(is_hamming[i])
			hamming[h++] = i;
	}
	return h;
}

int main()
{
	int m,n;
	while(cin >> m){
		if(m == 0)
			break;
		cin >> n;
		int count = 0;
		int h = make_ham(n+1);
		for(int i=0;i<h;i++){
			if(hamming[i] >= m)
				count++;
		}
		cout << count << endl;
	}
	return 0;
}