#include<iostream>

bool ham[1000001];
int cnt[1000001];

int main()
{
	ham[1] = true;

	cnt[1] = 1;

	for( int i = 2; i <= 1000000; ++i )
	{
		if( ( i % 2 == 0 && ham[i/2] ) || ( i % 3 == 0 && ham[i/3] ) || ( i % 5 == 0 && ham[i/5] ) )
			ham[i] = true;

		cnt[i] = cnt[i-1] + ham[i];
	}

	int m, n;
	while( std::cin >> m, m )
	{
		std::cin >> n;

		std::cout << cnt[n] - cnt[m-1] << std::endl;
	}

	return 0;
}