#include<iostream>
#include<vector>
#include<string>
using namespace std;

bool hamming(int a) {
	while (1) {
		if (a == 1)return true;
		if (a % 2 == 0) a /= 2;
		else if (a % 3 == 0) a /= 3;
		else if (a % 5 == 0) a /= 5;
		else return false;
	}
}
int main()
{
	while (1) {
		int a;
		cin >> a;
		if (a == 0)break;
		int b;
		cin >> b;
		int s = 0;
		for (int c = a; c < b + 1; c++) {
			if (hamming(c))s++;
		}
		cout << s << endl;
	}
}