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

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP(a, b) make_pair(a, b)
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int n, m;
vector<pi> s;
int dp[1024];
using namespace std;

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;
    }

    return 0;
}