#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int main()
{
  int m, n;
  bool a[1000010];
  int b[1000010];

  for(int i = 0; i < 1000010; i++) a[i] = false;

  for(int i = 1; i < 1000010; i *= 5) {
    for(int j = 1; i * j < 1000010; j *= 3) {
      for(int k = 1; i * j * k < 1000010; k *= 2) {
        a[i * j * k] = true;
      }
    }
  }

  b[0] = 0;
  for(int i = 1; i < 1000010; i++) {
    b[i] = b[i - 1] + (a[i] ? 1 : 0);
  }
  while(cin >> m, m){
    cin >> n;
    cout << b[n] - b[m - 1] << endl;
  }
}