#include<iostream>
#include<algorithm>
using namespace std;
#define MAX 1000000

bool hamming[MAX+1];
void init(){
	hamming[1]=true;
	for(int i=1;i<=MAX/2;i++){
		if(!hamming[i])continue;
		hamming[i*2]=true;
		if(i*3<=MAX)hamming[i*3]=true;
		if(i*5<=MAX)hamming[i*5]=true;
	}
}
int main(){
	int m,n;
	init();
	while(cin>>m>>n,m||n)cout<<count(hamming+m,hamming+(n+1),true);
}