#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

bool is_hamming[6000000];

int main(){
	
	for(int i = 0; i < 6000000; i++){
		is_hamming[i] = false;
	}
	
	is_hamming[1] = true;
	
	for(int i = 1; i <= 1000000; i++){
		if(is_hamming[i]){
			is_hamming[i * 2] = true;
			is_hamming[i * 3] = true;
			is_hamming[i * 5] = true;
		}
	}
	
	
	int m, n;
	
	while(true){
		
		cin >> m;
		
		if(m == 0){
			break;
		}
		
		cin >> n;
		
		int ans = 0;
		
		for(int i = m; i <= n; i++){
			if(is_hamming[i]){
				ans++;
			}
		}
		
		cout << ans << endl;
		
	}
	return 0;
}