#include<iostream>
#define N 1000000
using namespace std;

bool x[N + 1];

void setn();
int cntham(int m, int n);

int main(){
	setn();
	int m, n;
	while(cin >>m){
		if(m == 0) break;
		cin >>n;
		cout <<cntham(m, n) <<endl;
	}
	return 0;
}

void setn(){
	for(int i = 1; i <= N; i *= 2){
		x[i] = true;
	}
	for(int i = 1; i <= N; ){
		if(i * 3 <= N) x[i * 3] = true;
		if(i * 5 <= N) x[i * 5] = true;
		i++;
		while(x[i] == false && i < N){
			i++;
		}
	}
}

int cntham(int m, int n){
	int cnt = 0;
	for(int i = m; i <= n; i++){
		if(x[i] == true) cnt++;
	}
	return cnt;
}