#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;
#define N_MAX 1000000

int main()
{
	int res, st, ed;
	vector<bool> jud(N_MAX, false);
	jud[1] = true;

	for(int i = 1; i <= N_MAX/2; i++)
	{
		if(jud[i])
		{
			jud[i*2] = true;
			jud[i*3] = true;
			jud[i*5] = true;
		}
	}

	while(cin >> st, st)
	{
		cin >> ed;
		res = 0;
		for(int i = st; i <= ed; i++)
		{
			if(jud[i])
			{
				res++;
			}
		}
		cout << res << endl;
	}
}