#include<iostream>

int main(){
	int arr[1000001] = {0, 1, 1, 1, 1, 1};
	for(int i=6;i<=1000000;i++){
		if((i%2 == 0 && arr[i/2]) ||
			 (i%3 == 0 && arr[i/3]) ||
			 (i%5 == 0 && arr[i/5])){
			arr[i] = 1;
		}else{
			arr[i] = 0;
		}
	}

	int m, n;
	while(std::cin >> m >> n, m){
		int res = 0;
		while(m <= n){
			if(arr[m]){
				res++;
			}
			m++;
		}
		std::cout << res << std::endl;
	}
}