#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const int MAX = 1000000;

int main()
{
	vi hamming;
	for(int i=1; i<=MAX; i*=2){
		for(int j=i; j<=MAX; j*=3){
			for(int k=j; k<=MAX; k*=5){
				hamming.push_back(k);
			}
		}
	}
	sort(hamming.begin(), hamming.end());
	
	int m;
	while(scanf("%d", &m), m){
		int n;
		scanf("%d", &n);
		m = distance(hamming.begin(), lower_bound(hamming.begin(), hamming.end(), m));
		n = distance(hamming.begin(), upper_bound(hamming.begin(), hamming.end(), n));
		printf("%d\n", n-m);
	}
	
	return 0;
}