#include<bits/stdc++.h>
using namespace std;

int main(){
  int m, n;
  bool haming[1000001] = {};
  int sum[1000001] = {};

  for(int i = 1; i < 1000001; i *= 2){
    for(int j = i; j < 1000001; j *= 3){
      for(int k = j; k < 1000001; k *= 5){
        haming[k] = true;
      }
    }
  }
  haming[1] = true;
  for(int i = 1; i < 1000001; i++){
    sum[i] = sum[i - 1] + haming[i];
  }

  while(cin >> m){
    if(!m) break;
    cin >> n;
    cout << sum[n] - sum[m - 1] << endl;
  }
}