#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

int dp[1000001];
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	memset(dp, false, sizeof(dp));
	dp[1] = true;
	vector<int>ns{ 2,3,5 };
	for (int i = 1; i <= 1000000; ++i) {
		if (dp[i]) {
			for (int j = 0; j < 3; ++j) {
				if (i*ns[j] <= 1000000) {
					dp[i*ns[j]] = true;
				}
			}
		}
		
	}
	while (1) {
		int M; cin >> M;
		if (!M)break;
		int N; cin >> N;
		int ans = 0;
		for (int i = M; i <= N; ++i) {
			if (dp[i])ans++;
		}
		cout << ans << endl;

	}
	
	return 0;
}