#include <iostream>

using namespace std;

const int MAX = 1000000;
bool hamming[MAX];

int main(){
	int ps[3] = {2, 3, 5};
	int n, m;
	for(int i = 0;i < MAX;++i){
		n = i + 1;
		for(int j = 0;j < 3;++j){
			while(n % ps[j] == 0) n /= ps[j];
		}
		hamming[i] = n == 1 ? true : false;
	}
	while(cin >> m, m){
		cin >> n;
		int c = 0;
		--m;
		for(int i = m;i < n;++i){
			if(hamming[i]) ++c;
		}
		cout << c << endl;
	}
	return 0;
}