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

int h[1000001];
int dp[1000001];
int d[3]={2,3,5};
void ham(int s){
	memset(h,0,sizeof(h));
	memset(dp,0,sizeof(dp));
	h[1]=1;
	for(int i=0;i<3;i++){
		for(int j=1;j<=s;j++){
			if(h[j/d[i]]==1 && j%d[i]==0)h[j]=1;
		}
	}
	for(int i=1;i<=s;i++){
		dp[i]=dp[i-1]+h[i];
	}
}

int main(void){
	ham(1000000);
	while(1){
		int m,n;
		scanf("%d",&m);
		if(m==0)break;
		scanf("%d",&n);
		printf("%d\n",dp[n]-dp[m-1]);
	}
    return 0;
}