#include<iostream>
using namespace std;
typedef long long L;
int main() {
	L m,n;
	L a = 1;
	for (int i = 0; i < 10; i++)a *= 60;
	a *= 9;
	while (cin >> m, m) {
		cin >> n;
		int ans = 0;
		for (L i = m; i <= n; i++) {
			if (a%i==0)ans++;
		}
		cout << ans << endl;
	}
	return 0;
}