#include <iostream>
#include <cstdio>
#include <cstring>

#define MAX 1000001

using namespace std;

int main(){
  bool p[MAX];
  memset(p, 0, sizeof(p));
  
  for(int i = 1 ; i < MAX ; i++){
    int tmp = i;
    bool flag = true;
    while(tmp != 1){
      if(tmp % 2 == 0) tmp /= 2;
      else if(tmp % 3 == 0) tmp /= 3;
      else if(tmp % 5 == 0) tmp /= 5;
      else{
	flag = false;
	break;
      }
    }
    if(flag) p[i] = true;
  }

  int n, m;
  while(cin >> m, m){
    cin >> n;
    int cnt = 0;
    for(int i = m ; i <= n ; i++){
      if(p[i]) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}