#include <iostream>
using namespace std;

bool isHamming(int x){
		int j=x;
		while(j%2==0)
			j=j/2;
		while(j%3==0)
			j=j/3;
		while(j%5==0)
			j=j/5;
		if(j==1)
			return true;
		else
			return false;
}
	
int main(){

	while(true){
		int m,n;
		cin >> m;

		if(m==0)
			break;

		cin >> n;
	
		int ans=0;
		for(int i=m; i<=n; i++){
			if(isHamming(i))
				ans++;
		}
		cout << ans<< endl;
	}
	return 0;
}