#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<math.h>
#include<climits>

using namespace std;
typedef unsigned long long ll;

int x[1000002];

int main(){
    memset(x, 0, sizeof(x));
    x[1]=1;
    for(int i=2;i<1000002;i++){
        int t=i;
        if(t%2==0)t/=2;
        if(t%3==0)t/=3;
        if(t%5==0)t/=5;
        if(x[t]==1)x[i]=1;
    }
    for(int i=1;i<1000002;i++){
        x[i]+=x[i-1];
    }
    int m,n;
    while(cin>>m,m){
        cin>>n;
        cout<<x[n]-x[m-1]<<endl;
    }
    
}