#include<iostream>
#include<algorithm>
using namespace std;

int main(){

	int n, m, cnt, h[1000001], p[1000001];

	fill(h, h+1000001, 0);

	for(int i=1; i<=1000000; i*=2){
		for(int j=1; i*j<=1000000; j*=3){
			for(int k=1; i*j*k<=1000000; k*=5){
				h[i*j*k] = 1;
			}
		}
	}
	
	cnt = 0;
	for(int i=0; i<=1000000; i++){
		if(h[i] == 1) cnt++;
		p[i] = cnt;
	}
	
	while(cin >> m){
		if(m == 0) break;
		cin >> n;
		if(h[m] == 1) cout << p[n] - p[m] + 1 << endl;
		else cout << p[n] - p[m] << endl;
	}

	return 0;

}