#include <iostream>
using namespace std;

bool ishamming[1000001];
bool isHamming(int i) {
  int x = i;
  if(x % 5 == 0) x /= 5;
  if(x % 3 == 0) x /= 3;
  if(x % 2 == 0) x /= 2;
  if(ishamming[x]) {
    ishamming[i] = true;
    return true;
  } else {
    ishamming[i] = false;
    return false;
  }
}

main() {
  int hammingNum[1000001];
  hammingNum[1] = 1;
  ishamming[1] = true;
  for(int i = 2; i <= 1000000; i++) {
    hammingNum[i] = hammingNum[i-1];
    if(isHamming(i)) hammingNum[i]++;
    if(i <= 20) {
    }
  }
  while(1) {
    int m, n;
    cin >> m;
    if(m == 0) break;
    cin >> n;
    cout << hammingNum[n] - hammingNum[m-1] << endl;
  }
}