#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

vector<int> hamming;
set<int> used;
void add_hamming(int n)
{
	if (n > 1000000 || used.count(n))
		return;
	used.insert(n);
	hamming.push_back(n);
	add_hamming(2*n);
	add_hamming(3*n);
	add_hamming(5*n);
}
int main()
{
	add_hamming(1);
	sort(hamming.begin(), hamming.end());

	int n, m;
	while (scanf("%d %d", &n, &m), n)
		printf("%d\n", upper_bound(hamming.begin(), hamming.end(), m)
		- lower_bound(hamming.begin(), hamming.end(), n));

	return 0;
}