#include <stdio.h>
#include <stack>
#include <math.h>

using namespace std;

int main(){

	int m,n,elem[3] = {2,3,5},tmp;
	int* table = new int[1000001];
	table[0] = 0;
	table[1] = 1;

	for(int i = 2; i <= 1000000; i++){
		tmp = i;
		for(int k = 0; k < 3; k++){
			while(tmp%elem[k] == 0){
				tmp /= elem[k];
			}
		}
		if(tmp == 1){
			table[i] = table[i-1]+1;
		}else{
			table[i] = table[i-1];
		}
	}


	while(true){
		scanf("%d %d",&m,&n);
		if(m == 0)break;

		printf("%d\n",table[n]-table[m]+1);
	}

    return 0;
}