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

const int MAX_NUM = 1000000;

int main(){
	bool list[MAX_NUM + 1] = {0};
	
	for(int two = 0;two <= 20;two++){
		for(int three = 0;three <= 13;three++){
			for(int five = 0;five <= 9;five++){
				int num = pow(2, two) * pow(3, three) * pow(5, five);
				if(1 <= num && num <= MAX_NUM) list[num] = true;
			}
		}
	}
	int m, n;
	while(1){
		cin >> m;
		if(m == 0) break;
		cin >> n;
		int ans = 0;
		for(int i = m;i <= n;i++){
			if(list[i]) ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}