#include <iostream>

using namespace std;

bool is_hamming(int n) {
    while (true) {
        if (n % 5 != 0) break;
        n /= 5;
    }
    while (true) {
        if (n % 3 != 0) break;
        n /= 3;
    }
    while (true) {
        if (n % 2 != 0) break;
        n /= 2;
    }
    if (n == 1) return true;
    else return false;
}

int main() {
    int a, b;
    while (cin >> a) {
        if (a == 0) break;
        cin >> b;
        int count = 0;
        for (int i = a; i <= b; i++) {
            if (is_hamming(i)) count++;
        }
        cout << count << endl;
    }
    return 0;
}