#include <iostream>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
const int MX = 1000000;
int main(){
	bool h[MX+1] = {};
	h[1] = h[2] = h[3] = h[5] = 1;
	rep2(i,2,MX+1) {
		if(h[i]) {
			if(i*2 <= MX) h[i*2] = 1;
			if(i*3 <= MX) h[i*3] = 1;
			if(i*5 <= MX) h[i*5] = 1;
		}
	}
    int m, n;
	while(cin >> m, m) {
		cin >> n;
		int cnt = 0;
		rep2(i,m,n+1) {
			if(h[i]) cnt++;
		}
		cout << cnt << endl;
	}
    return 0;
}