#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-10
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
typedef pair<int,int> Pii;
typedef vector<int> vi;
int ans[1000001];
ll mod_pow(ll x, ll n ,ll mod){
	if(n == 0) return 1;
	ll res = mod_pow(x*x%mod,n/2,mod);
	if(n & 1) res = res * x % mod;
	return res;
}
void makeHammingNumbers(){
	rep(i,1000000){
		rep(j,13){
			if(mod_pow(60,j,i+1)==0){
				ans[i+1] = 1;
				break;
			}
		}
	}
	return ;
}
int main(){
	makeHammingNumbers();
	reps(i,1,1000000){
		ans[i+1] += ans[i];
	}
	int m;
	while(scanf("%d",&m),m){
		int n;
		scanf("%d",&n);
		printf("%d\n",ans[n]-ans[m-1]);
	}
	return 0;
}