#include <iostream>
#include <cstring>
#include <sstream>
//#include <fstream>

using namespace std;

const int MAX_N = 1000000;
bool hamming[MAX_N + 1];

bool ishamming (int n )
{
	while (n % 2 == 0 ){
		n /= 2;
	} // end while
	while (n % 3 == 0 ){
		n /= 3;
	} // end while
	while (n % 5 == 0 ){
		n /= 5;
	} // end while

	return (n == 1 );
}
	
void make_hamming (void )
{
	memset (hamming, false , sizeof (hamming ) );

	for (int i = 1; i <= MAX_N; ++i){
		if (ishamming(i ) ){
			hamming[i] = true;
		} // end if
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.hamming", "r", stdin );
	string str = "";

	make_hamming();

	while (getline (cin, str ) ){
		int m, n;

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if

		stringstream ss (str );
		ss >> m >> n;
		
		int res = 0;

		for (int i = m; i <= n; ++i){
			if (hamming[i] ){
				++res;
			} // end if
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}