#include <iostream>
using namespace std;

int main(){
	bool isHamming[1000001];
	int n,m;
	for(int i = 0; i < 1000001; i++){
		isHamming[i]=false;
	}
	for(int i = 1; i < 1000001; i *= 2){
		for(int j = i; j < 1000001; j *= 3){
			for(int k = j; k < 1000001; k *= 5){
				isHamming[k] = true;
			}
		}
	}
	while(true){
		cin >> n;
		if(cin.eof() || n == 0){
			break;
		}
		cin >> m;
		int c=0;
		for(int i = n; i <= m; i++){
			if(isHamming[i])
				c++;
		}
		cout << c << endl;
	}
	return 0;
}
