#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n, m;
  constexpr int max_n = 1e6+1;
  vector<int> H = {1};
  int p[] = {2,3,5};
  for(int i = 0; i < 3; ++i){
    int s = H.size();
    for(int k = 0; k < s; ++k){
      int h = H[k];
      while(h*p[i] < max_n){
        h *= p[i];
        H.push_back(h);
      }
    }
  }
  sort(H.begin(),H.end());
  // for(auto h : H){
  //   cerr << h << " ";
  // }
  // cerr << endl;
  while(cin >> m, m){
    cin >> n;
    int a = upper_bound(H.begin(),H.end(),n) - lower_bound(H.begin(),H.end(),m);
    cout << a << endl;
  }
}

