#include<iostream>
using namespace std;
 
int dp[1000001] = {0};
int main() {
        int a=1,n,m;
        for(int i = 0 ; a <= 1000000 ; i++){
                int b = 1;
                for(int j = 0 ; a*b <= 1000000 ; j++){
                        int c = 1;
                        for(int k = 0 ; a*b*c <= 1000000 ; k++){
                                dp[a*b*c] = true;
                                c *= 5;
                        }
                        b *= 3;
                }
                a *= 2;
        }
        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;
}