#include <iostream>

using namespace std;

bool P[1000001];
int a[3] = {2,3,5};

void init()
{
	for( int i = 0;i < 1000001;i++ ) P[i] = false;
	P[1] = true;
	for( int i = 1;i < 1000001;i++ ){
		if( P[i] ){
			for( int j = 0;j < 3;j++ ) if( i * a[j] < 1000001 ) P[i * a[j]] = true;
		}
	}
}

int main(int argc, char const* argv[])
{
	init();
	int m,n;

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