#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    bool s[1000005] = {0}, f;
    s[1] = true;
    s[0] = false;
    int i = 1;
    rep(i, 1000005){
        if(s[i] == true){
            if(i * 2 < 1000005){
                s[i * 2] = true;
            }
            if(i * 3 < 1000005){
                s[i * 3] = true;
            }
            if(i * 5 < 1000005){
                s[i * 5] = true;
            }
        }
    }
    int m,n;
    while(cin >> m, m){
        cin >> n;
        int ans = 0;
        range(j, m, n + 1){
            if(s[j] == true)
                ans++;
        }
        cout << ans << endl;
    }
}