#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int LIM = 10000001;
char h[LIM];
int sh[LIM];

bool solve() {
    int m, n;
    cin >> m;
    if (m == 0) { return false; }
    cin >> n;
    cout << (sh[n] - sh[m-1]) << endl;
    return true;
}

int main() {
    fill(h, h+LIM, 0);
    h[1] = 1;
    for (int j = 2; j < LIM; ++j) {
        if (j % 2 == 0) { h[j] |= h[j/2]; }
        if (j % 3 == 0) { h[j] |= h[j/3]; }
        if (j % 5 == 0) { h[j] |= h[j/5]; }
    }
    sh[0] = 0;
    for (int j = 1; j < LIM; ++j) {
        sh[j] = sh[j-1] + h[j];
    }
    while(solve());
    return 0;
}