#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

//a^n
LL Pow(LL a, LL n) {
	LL ans = 1;
	while (n > 0) {
		if (n & 1)ans *= a;
		a *= a;
		n >>= 1;
	}
	return ans;
}

VL Hamming() {
	VL ret;
	rep(i2, 21) {
		rep(i3, 14) {
			rep(i5, 10) {
				LL x = Pow(2, i2)*Pow(3, i3)*Pow(5, i5);
				if (x <= 1000000)ret.pb(x);
			}
		}
	}
	sort(all(ret));
	return ret;
}


int main() {
	VL hu = Hamming();

	while (true) {
		LL m, n; cin >> m;
		if (m == 0)break; cin >> n;

		LL ans = 0;
		for (auto aa : hu) {
			if (m <= aa && aa <= n)ans++;
		}
		Cout(ans);
	}
}

/*
2^20 > 10^6
3^13 > 10^6
5^9  > 10^6
*/
