#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
static const int lim = 1000001;
vector<int> dp(lim,0);
int main() {

	for (int s = 1; s < lim; s *= 2) {
		for (int t = s; t < lim; t *= 3) {
			for (int u = t; u < lim; u *= 5) {
				dp[u] = 1;
			}
		}
	}
	for (int i = 1; i < lim; i++)dp[i] += dp[i - 1];


	int m, n;
	while (cin >> m >> n, m) {
		cout << dp[n] - dp[m - 1] << endl;
	}


	return 0;
}