#include<iostream>
#define N 1000001
using namespace std;

int main(){
int num;
int sum[N];
int n,m;

sum[0] = 0;
num = 0;
for(int i=1;i<N;i++){
int tmp = i;
while(!(tmp%2))tmp/=2;
while(!(tmp%3))tmp/=3;
while(!(tmp%5))tmp/=5;
if(tmp==1)num++;
sum[i] = num;
}

while(1){
cin >> m;
if(!m)break;
cin >>n;
cout << sum[m] - sum[n-1] << endl;
}