#include<iostream>
using namespace std;

int main(){
	int m, n, cou, sixty;
	while(1){
		cin >>m;
		if(m == 0) break;
		cin >>n;
		cou = 0;
		for(int i = m; i <= n; i++){
			sixty = 1;
			for(int j = 0; j < 5; j++){
				sixty *= 60;
				if(sixty % i == 0){
					cou++;
					break;
				}
			}
		}
		cout <<cou <<endl;
	}
	
	return 0;
}