#include <iostream>

int isHamming(int n)
{
	while (n%2==0) n/=2;
	while (n%3==0) n/=3;
	while (n%5==0) n/=5;
	return (n==1) ? 1 : 0;
}

int main()
{
	int m, n;
	while (true) {
		std::cin >> m;
		if (m==0) break;
		std::cin >> n;
		int res = 0;
		for (int i=m; i<=n; i++) {
			res += isHamming(i);
		}
		std::cout << res << std::endl;
	}
	return 0;
}

