#include<iostream>
using namespace std;

int dp[1000001] = {0};
int main() {
	int k,m,n;
	dp[1] = 1;
	for(int i = 1 ; i <= 500000 ; i++){
		dp[i*2] |= 1;
		dp[i*3] |= 1;
		dp[i*5] |= 1;
	}
	for(int i = 1 ; i <= 1000000 ; i++){
		dp[i] += dp[i-1];
	}
	while(cin >> m&&m){
		cin >> n;
		cout << dp[n] - dp[m-1] << endl;
	}
	return 0;
}