#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 1000000 + 10;

bool ham[MAXN];

int main()
{
    ham[1] = 1;
    REP(MAXN)if(ham[i])
    {
        for(int j=i*2; j<MAXN;j*=2)ham[j] = 1;
        for(int j=i*3; j<MAXN;j*=3)ham[j] = 1;
        for(int j=i*5; j<MAXN;j*=5)ham[j] = 1;
    }
    int m, n;
    while(cin >> m && m)
    {
        cin >> n;
        int ans = 0;
        for(int i = m;i<=n;i++)if(ham[i])ans++;
        cout << ans << endl;
    }

    return 0;
}