#include<iostream>
#define N 1000001
using namespace std;

int main(){
int sum[N];
bool ham[N];
int n,m;

for(int i=0;i<N;i++)ham[N] = false;

int tmp = 1;
int t2 = 1, t3 = 1;
while(tmp < N){
	while(tmp < N){
		while(tmp < N){
			ham[tmp] = true;
			tmp *= 5;
		}
		t3 *= 3;
		tmp = t3 * t2;
	}
	t2 *= 2;
	tmp = t2;
	t3 = 1;
}

tmp = 0;
for(int i=0;i<N;i++){
	if(ham[i])tmp++;
	sum[i] = tmp;
}

while(1){
cin >> m;
if(!m)break;
cin >> n;
cout << sum[n] - sum[m-1] << endl;
}
}