#include<bits/stdc++.h>
using namespace std;
bool ham[1000001];
int main(){
  ham[1]=1;
  for(int i=0;i<1000001;i++)
    if(ham[i]){
      if(i*2<=1000000)ham[i*2]=1;
      if(i*3<=1000000)ham[i*3]=1;
      if(i*5<=1000000)ham[i*5]=1;
    }
  int x,y;
  while(cin>>x,x){
    cin>>y;
    int sum=0;
    for(int i=x;i<=y;i++)
      if(ham[i])sum++;
    cout<<sum<<endl;
  }
}