#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    bool latte[1000001];
    fill(latte,latte+1000001,false);
    latte[1]=true;
    for(int i=1;i<=1000000;i++){
         if(!latte[i])continue;
         if(i*2<=1000000)latte[i*2]=true;
         if(i*3<=1000000)latte[i*3]=true;
         if(i*5<=1000000)latte[i*5]=true;
    }
    int m;
    while(cin>>m,m){
        int n;
        cin>>n;
        int cnt=0;
        for(int i=m;i<=n;i++)if(latte[i])cnt++;
        cout<<cnt<<endl;
    }
}