#include <iostream>
#include <cstring>
using namespace std;

#define N 1000000
int isHamming(int x){
  while (x%2==0) x /= 2;
  while (x%3==0) x /= 3;
  while (x%5==0) x /= 5;
  return x==1;
}

int main(void){
  int cnt[N+1], a, b;
  
  cnt[0] = 0;
  for (int i=1; i<=N; i++){
    cnt[i] = cnt[i-1] + isHamming(i);
  }
  while (cin >> a){
    if (a==0) break;
    cin >> b;
    cout << (cnt[b] - cnt[a-1]) << endl;
  } 
  return 0;
}
  
  

