#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int hum[1000001];

int main()
{	
	memset(hum,0,sizeof(hum));
	int count = 1;
	REP(i,1,1000001)
	{
		int temp = i;
		while(temp != 1)
		{
			if(temp%2 == 0) temp /= 2;
			else if(temp%3 == 0) temp /= 3;
			else if(temp%5 == 0) temp /= 5;
			else break;
		}

		if(temp == 1)
		{
			hum[i] = count;
			count++;
		}
		else
		{
			hum[i] = hum[i-1];
		}
	}
	
	int n,m;
	while(cin >> n && n)
	{
		cin >> m;	
		cout << hum[m] - hum[n-1]<< endl;
	}
	return 0;
}