#include <bits/stdc++.h>

using namespace std;


int HammingData[1000001] = {0,1};

void judge() {
	int tmp;
	bool flag;

	for (int i = 2; i < 1000001; i++) {
		tmp = i;
		flag = true;
		while (tmp != 1) {
			if (tmp % 2 == 0) {
				tmp /= 2;
			}
			else if (tmp % 3 == 0) {
				tmp /= 3;
			}
			else if (tmp % 5 == 0) {
				tmp /= 5;
			}
			else {
				flag = false;
				break;
			}
		}
		if (flag) {
			HammingData[i] = 1;
		}
	}
}


int main(void) {
	int n, m, sum;

	judge();

	while (cin >> m, m) {
		cin >> n;
		n++;
		sum = 0;
		for (int i = m; i < n; i++) {
			if (HammingData[i] == 1) {
				sum++;
			}
		}
		cout << sum << endl;
	}

	return 0;
}
