##include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;

int main(){
	long long int A,B;
	int n[101][101][3]={};
	while(1){
		cin>>A>>B;
		if(A==0&&B==0)break;
		long long int g=60;int c=0;
		for(long long int i=A;i<=B;i++){g=60;
		for(long long int j=1;j<11;j++)
		{
			if(g%i==0){//cout<<g<<endl;
			c++;break;}
		else{g*=60;}
		}
		}
		cout<<c<<endl;
		/*

		int d=1;
		for(int i=0;i<A;i++)
			for(int j=0;j<A;j++){
			if(n[i][j][3]<d)
		
		*/
	}
	return 0;
}