#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
vector<bool>ha(1000010,false);
void hami(vector<bool>& ha,int n){
  if(n*2<=1000000&&!ha[2*n]){ha[2*n]=true;hami(ha,n*2);}
  if(n*3<=1000000&&!ha[3*n]){ha[3*n]=true;hami(ha,n*3);}
  if(n*5<=1000000&&!ha[5*n]){ha[5*n]=true;hami(ha,n*5);}
}
int main(){
  hami(ha,1);
  ha[1]=true;

  int n,m;
  while(cin>>n,n){
    cin>>m;
    int co=0;
    loop(i,n,m+1)if(ha[i])co++;
    cout<<co<<endl;
  }
}