#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

bool h[1000001];
const int a[3] = {2,3,5};

int main(){
	h[0] = h[1] = true;
	for(int i=1;i<=1000000;i++){
		if(!h[i]) continue;
		for(int j=0;j<3;j++) if(i*a[j]<=1000000) h[i*a[j]] = true;
	}
	int M,N;
	while(cin>>M,M){
		cin>>N;
		int ans = 0;
		for(int i=M;i<=N;i++) ans += h[i];
		printf("%d\n",ans);
	}
	return 0;
}