
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  vi hamming(1000001,0);
  loop(i,1,1000001){
    int t=i;
    while(t%2==0)t/=2;
    while(t%3==0)t/=3;
    while(t%5==0)t/=5;
    if(t==1)hamming[i]++;
  }
  rep(i,1000000)
    hamming[i+1]+=hamming[i];
 
  while(1){
    int n,m;
    cin>>n;
    if(n==0)break;
    cin>>m;
    cout<<hamming[m]-hamming[n-1]<<endl;
  }
}