#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    vector<int> acc(5000000, 0);
    acc[1] = 1;
    for(int i = 1; i <= 1000100; i++){
        if(acc[i] == 0) continue;
        acc[i * 2] = 1;
        acc[i * 3] = 1;
        acc[i * 5] = 1;
    }

    for(int i = 2; i <= 1000100; i++) acc[i] += acc[i - 1];
    
    while(1){
        int n, m; cin >> n >> m;
        if(n == 0) break;
        cout << acc[m] - acc[n - 1] << endl;
    }
    return 0;
}

