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

const int HAMMING_MAX = 1000001;

int main()
{
	bool hamming[ HAMMING_MAX ];
	memset( hamming, 0, sizeof(hamming) );

	for( int x = 1; x < HAMMING_MAX; x *= 2 ){
		for( int y = 1; x * y < HAMMING_MAX; y *= 3 ){
			for( int z = 1; x * y * z < HAMMING_MAX; z *= 5 ){
				int h = x * y * z;
				hamming[ h ] = true;
			}
		}
	}

	int n, m;
	while( cin >> n && n ){
		cin >> m;
		int count = 0;
		for( int i = n; i <= m; ++i ){
			if( hamming[ i ] ){
				++count;
			}
		}
		cout << count << endl;
	}

	return 0;
}