#include <iostream>
#include <cstdio>

#define M_N 1000000

int h_num[M_N + 10];

using namespace std;

int main()
{
	for (int i = 1; i <= M_N; i *= 2){
		for (int j = i; j <= M_N; j *= 3){
			for (int k = j; k <= M_N; k *= 5){
				h_num[k] = 1;
			}
		}
	}
	
	for (int i = 1; i <= M_N; i++){
		h_num[i] += h_num[i - 1];
	}
	
	int n, m;
	while (cin >> m, m){
		cin >> n;
		cout << h_num[n] - h_num[m - 1] << endl;
	}
	
	return (0);
}