#include<bits/stdc++.h>
using namespace std;
int main()
{
    bool hamming[1000001]={};
    for(int i=1;i<1000001;i*=2){
        for(int j=i;j<1000001;j*=3){
            for(int k=j;k<1000001;k*=5)hamming[k]=1;
        }
    }
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++)if(hamming[i])co++;
        cout<<co<<endl;
    }
}