#include <iostream>
#include <cstring>
using namespace std;

#define NMAX 1000000

int main() {
  int h[NMAX+1];
  int n[] = {2,3,5};
  int a, b, t;
  memset(h, 0, sizeof(h));
  h[1] = 1;
  for (int i=0; i<3; i++) {
    for (int j=1; j<=NMAX; j++) {
      if (!h[j]) continue;
      t = j * n[i];
      if (t <= NMAX) {
        h[t] = 1;
      }
    }
  }
  for (int i=1; i<NMAX; i++) {
    h[i] += h[i-1];
  }
  while (1) {
    cin >> a;
    if (!a) break;
    cin >> b;
    cout << h[b]-h[a-1] << endl;
  }
  return 0;
}