#include <cstdio>
#include <iostream>
#define MAX 1000001
#include <cmath>
using namespace std;

bool a[MAX];

int main(){
  int i,j,n,m,ans;
  for(i=1;i<MAX;i*=2) a[i] = true;
  for(i=1;i<MAX;i*=3) a[i] = true;
  for(i=1;i<MAX;i*=5) a[i] = true;
  for(i=1;i<MAX;i++){
    if(a[i]){
      if(i * 2 < MAX) a[i*2] = true;
      if(i * 3 < MAX) a[i*3] = true;
      if(i * 5 < MAX) a[i*5] = true;
    }
  }

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

  }
  return 0;
}