#include <cstdio>
#include <iostream>
using namespace std;

#define MAX 1000000

int num[MAX];

int main()
{
	for (int i = 1; i <= MAX; i *= 2){
		for (int j = i; j <= MAX; j *= 3){
			for (int k = j; k <= MAX; k *= 5){
				num[k] = true;
			}
		}
	}

	for (int i = 1; i <= MAX; i++){
		num[i] += num[i - 1];
	}

	int m, n;

	while (scanf("%d", &m), m){
		scanf("%d", &n);
		printf("%d\n", num[n] - num[m - 1]);
	}

	return (0);
}