#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

const int list[3] = { 2, 3, 5 };
const int MAX_N = 1000002;
char dp[MAX_N];
int m, n;

int main() {
  fill(dp, dp + MAX_N, 0);
  dp[1] = 1;
  rep (i,MAX_N) if (dp[i]) {
    rep (j,3) if (i * list[j] < MAX_N) {
      dp[i * list[j] ] = 1;
    }
  }
  while (cin >> m, m) {
    cin >> n;
    int ans = 0;
    for (int i = m; i <= n; ++i) if (dp[i]) ans++;
    cout << ans << endl;
  }
  return 0;
}