#include<iostream>
using namespace std;

int main(){
  int n,m,k,ans;
  bool h[1000001];
  bool f;

  for(int i=0;i<=1000000;i++)h[i] = false;
  h[1] = true;

  k = 2;
  f = true;
  while(f){
    f = false;
    for(int i=1;i<=1000000/k;i++){
      if(h[i]){
	if(!h[k*i]){
	  f = true;
	  h[k*i] = true;
	}
      }
    }
    k *= 2;
  }

  k = 3;
  f = true;
  while(f){
    f = false;
    for(int i=1;i<=1000000/k;i++){
      if(h[i]){
	if(!h[k*i]){
	  f = true;
	  h[k*i] = true;
	}
      }
    }
    k *= 3;
  }

  k = 5;
  f = true;
  while(f){
    f = false;
    for(int i=1;i<=1000000/k;i++){
      if(h[i]){
	if(!h[k*i]){
	  f = true;
	  h[k*i] = true;
	}
      }
    }
    k *= 5;
  }

  while(1){
    cin >> n;
    if(!n)break;
    cin >> m;

    ans = 0;
    for(int i=n;i<=m;i++){
      if(h[i])ans++;
    }
    cout << ans << endl;
  }
}