#include <iostream>
#include <string.h>

using namespace std;
int Memo[1000001];
bool IsHamming[1000001];

void Calc()
{
	memset(IsHamming, 0, sizeof(bool) * 1000001);
	for(int i = 1; i < 1000001; ++i)
	{
		int temp = i;
		while(temp % 2 == 0)
		{
			temp /= 2;
		}
		while(temp % 3 == 0)
		{
			temp /= 3;
		}
		while(temp % 5 == 0)
		{
			temp /= 5;
		}
		if(temp == 1)
		{
			IsHamming[i] = true;
		}
	}
	int count = 0;
	for(int i = 1; i < 1000001; ++i)
	{
		if(IsHamming[i])
		{
			count++;
		}
		Memo[i] = count;
	}
}

void solve()
{
	Calc();
	int	m, n;
	while(cin >> m)
	{
		if(!m)
		{
			break;
		}
		cin >> n;
		if(IsHamming[m])
		{
			cout <<	Memo[n] - Memo[m] + 1 << endl;
		} 
		else
		{
			cout << Memo[n] - Memo[m] << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}