#include<iostream>
using namespace std;
 
int dp[5000001] = {0};
int main() {
        int k,m,n;
        dp[1] = 1;
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i*2] |= dp[i];
                dp[i*3] |= dp[i];
                dp[i*5] |= dp[i];
        }
        for(int i = 1 ; i <= 1000000 ; i++){
                dp[i] += dp[i-1];
        }
        while(cin >> m && m){
                cin >> n;
                cout << dp[n] - dp[m-1] << endl;
        }
        return 0;
}