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

int main(void){
	bool isham[1000001];
	vector<int> ham;
	isham[1] = true;
	ham.push_back(1);
	for(int i=1;i<500001;i++){
		if(!isham[i]) continue;
		if(i*2 < 1000001){
			isham[i*2] = true;
			if(find(ham.begin(),ham.end(),i*2) == ham.end()){
				ham.push_back(i*2);
			}
		}
		if(i*3 < 1000001){
			isham[i*3] = true;
			if(find(ham.begin(),ham.end(),i*3) == ham.end()){
				ham.push_back(i*3);
			}
		}
		if(i*5 < 1000001){
			isham[i*5] = true;
			if(find(ham.begin(),ham.end(),i*5) == ham.end()){
				ham.push_back(i*5);
			}
		}
	}
	sort(ham.begin(),ham.end());

	int n,m;
	while(cin >> n && n){
		cin >> m;
		cout << upper_bound(ham.begin(),ham.end(),m) - lower_bound(ham.begin(),ham.end(),n) << endl;
	}
}