#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define INF 1<<30

int main() {
  int N = 1000000;
  bool dp[N+1];
  dp[1] = true;
  for (int i=2; i<=N; ++i) {
    if (i%2==0&&dp[i/2] || i%3==0&&dp[i/3] || i%5==0&&dp[i/5]) {
      dp[i] = true;
    } else {
      dp[i] = false;
    }
  }
  int m,n;
  while(cin>>m,m) {
    cin >> n;
    cout << count(dp+m, dp+n+1, true) << endl;
  }
}