#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

bool isHamming(int n) {
  while (n % 2 == 0) n /= 2;
  while (n % 3 == 0) n /= 3;
  while (n % 5 == 0) n /= 5;
  return n == 1;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int cum[1000010] = {};
  for (int i = 1; i <= 1000000; i++) {
    cum[i] = isHamming(i);
    cum[i] += cum[i - 1];
  }
  int m, n;
  while (cin >> m, m) {
    cin >> n;
    cout << cum[n] - cum[m - 1] << endl;
  }

  return 0;
}
