#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
static const int MAX=1000000;
bool judge(int n){
  while(n%2==0) n/=2;
  if(n==1) return true;
  while(n%3==0) n/=3;
  if(n==1) return true;
  while(n%5==0) n/=5;
  if(n==1) return true;
  return false;
}
int main(void){
  bool isHamming[MAX];
  for(int i=1; i<=MAX; i++){
    isHamming[i] = judge(i);
  }
  int m,n;
  while(cin>>m){
    if(m==0) break;
    cin>>n;
    int count=0;
    for(int i=m; i<=n; i++){
      if(isHamming[i]){
        count++;
      }
    }
    cout<<count<<endl;
  }
  return 0;
}