#include <iostream>
#include <algorithm>
using namespace std;

const int N = 1000000;
bool haming[N];

int main(){
    int m, n;
    fill(haming, haming + N, false);
    for(int i = 1;i < N;i <<= 1){
        for(int j = 1;i * j < N;j *= 3){
            for(int k = 1;i * j * k < N;k *= 5){
                haming[i * j * k] = true;
            }
        }
    }
    while(cin >> m, m){
        int c = 0;
        cin >> n;
        for(int i = m; i <= n;++i){
            if(haming[i]) ++c;
        }
        cout << c << endl;
    }
    return 0;
}