// AOJ 0162
#include <iostream>

using namespace std;

bool is_hamming(int num){
	while (num % 2 == 0){
		num /= 2;
	}
	while (num % 3 == 0){
		num /= 3;
	}
	while (num % 5 == 0){
		num /= 5;
	}

	return (num == 1);
}

int main(void)
{
	int m, n;
	while (cin >> m, m){
		cin >> n;
		int ret = 0;
		for (int i = m; i <= n; i++){
			if (i == 1){
				ret++;
				continue;
			}
			if (is_hamming(i)){
				ret++;
				// cout << i << endl;
			}
		}
		cout << ret << endl;
	}

	return 0;
}