#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){
        int t = i;
        while((t & 1) != 1) t >>= 1;
        while(t % 3 == 0) t /= 3;
        while(t % 5 == 0) t /= 5;
        if(t == 1) haming[i] = 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;
}