#include<iostream>
#include<vector>
using namespace std;
int a[1000001];
int b[1000001];
int n,m;

int main(){
  a[1]=1;
  for(int i=2;i<=1000000;i++){
    if(i%2==0){
      a[i]=a[i/2];
    }else if(i%3==0){
      a[i]=a[i/3];
    }else if(i%5==0){
      a[i]=a[i/5];
    }
  }

  for(int i=1;i<=1000000;i++)b[i]=a[i]+b[i-1];
  
  while(1){
    cin>>n;
    if(n==0)break;
    cin>>m;
    cout<<b[m]-b[n-1]<<endl;
  }
  return 0;
}