#include <bits/stdc++.h>

using namespace std;

const int MAX = 1000000;

int dp[MAX + 1] = {};

void check(int a, int b, int c) {
  int mul = 1;
  for (int i = 0; i < a; i++) {
    mul *= 2;
    if (mul > MAX) return;
  }
  for (int i = 0; i < b; i++) {
    mul *= 3;
    if (mul > MAX) return;
  }
  for (int i = 0; i < c; i++) {
    mul *= 5;
    if (mul > MAX) return;
  }
  dp[mul] = 1;
}

int main(void) {
  int m, n;

  for (int i = 0; i < 20; i++) {
    for (int j = 0; j < 13; j++) {
      for (int k = 0; k < 9; k++) {
        check(i, j, k);
      }
    }
  }
  for (int i = 1; i <= MAX; i++) {
    dp[i] += dp[i - 1];
  }

  while (cin >> m, m) {
    cin >> n;
    cout << dp[n] - dp[m - 1] << endl;
  }

  return 0;
}
