#include <iostream>
#include <vector>

using namespace std;
const long ma = 1000010;
bool hams[ma];
void ham(long);

void gen(){
    for(int i=0;i<ma;i++){
        hams[i] = false;
    }
    ham(1);
}

void ham(long n){
    if(n > ma) return;
    if(hams[n]) return;
    hams[n] = true;
    ham(2*n);
    ham(3*n);
    ham(5*n);
}

int count(int m,int n){
    int c;
    for(int i=m;i<n+1;i++){
        if(hams[i]) c++;
    }
    return c;
}

int main(){
    gen();
    int m,n;
    while(true){
        cin >> m;
        if(m==0)break;
        cin >> n;
        cout << count(m,n) << endl;
    }
}