#include<iostream>
#include<cmath>
#define MAX 1000005
bool ham[MAX];
int num_ham[MAX];
using namespace std;
void MakeHammings(){
	const int mul[] = {2,3,5};
	ham[1] = true;
	num_ham[0] = 0;
	for(int i = 1; i < MAX; ++i){
		num_ham[i] = num_ham[i-1];
		if( ham[i] ){
			num_ham[i]++;		
			for(int k = 0; k < sizeof(mul)/sizeof(*mul); ++k){
				for(int j = 1; i * (int)pow((double)mul[k],j) < MAX; ++j){
					ham[i*(int)pow((double)mul[k],j)] = true;
				}
			}
		}
	}
}
int main(){
	MakeHammings();
	while(true){
		int m,n;
		scanf("%d", &m);
		if(m==0)break;
		scanf("%d",&n);
		printf("%d\n", num_ham[n]-num_ham[m]+(ham[m]?1:0));
	}
}