#include <iostream>
#include <stdio.h>

using namespace std;
int s[1000001];
int main() {
int m,n,c2,c3,c5,i,k=0;
for (c5=1;c5<=1000000;c5*=5) for (c3=1;c3*c5<=1000000;c3*=3) for (c2=1;c2*c3*c5<=1000000;c2*=2) s[c2*c3*c5]=1;
for (i=0;i<=1000000;i++) { k+=s[i]; s[i]=k; }
while(cin >> m) {
	if (m==0) break;
	cin >> n;
	cout << s[n]-s[m-1] << endl;
	}
return 0;
 }