//2013/11/25(Mon)

#include <iostream>
using namespace std;

int main()
{
	int m,n;

	bool ham[1000001];
    for(int i=0; i<=1000000; i++)
        ham[i] = false;
 
    for(int i=1; i<=1000000; i*=2)
        for(int j=i; j<=1000000; j*=3)
            for(int k=j; k<=1000000; k*=5)
                ham[k] = true;
 
    while(true){
		  int cnt = 0;

			cin >> m;
        if(m==0)
            break;
			cin >> n;
 
        for(int i=m; i<=n; i++)
            if(ham[i] == true)
                cnt++;
 
        cout << cnt << endl;
    }
 
    return 0;
}