#include<iostream>
using namespace std;

#define MAX 1000001

//最初に列挙
int h_hamingu[MAX] = {0};

//掛ける変数
const int h_kakeru[3] = {2 , 3 , 5};

//----- 関数で列挙 -----//
void f_rekkyo();


int main(void)
{
	//入力変数
	int first = 0;
	int second = 0;

	//関数で列挙
	f_rekkyo();

	while (true)
	{
		//入力
		cin >> first;
		if (first == 0)	{	return 0;	}
		cin >> second;
		//カウント変数
		int count = 0;

		for (int i = first; i <= second; i++)
		{
			if (h_hamingu[i] == 1)
			{
				count++;
			}
		}

		cout << count << endl;
	}

	return 0;
}



//*****----- 最初に列挙 -----*****//

void f_rekkyo()
{
	//1はハミング
	h_hamingu[1] = 1;

	for (int i = 0; i < MAX; i++)
	{
		if (h_hamingu[i] == 1)
		{
			for (int j = 0; j < 3; j++)
			{
				if (i * h_kakeru[j] <= 1000000)
				{
					h_hamingu[i * h_kakeru[j]] = 1;
				}
			}
		}
	}
}