#include<iostream>
using namespace std;
bool f(int a)
{
	while(a%3<1)a/=3;
	while(a%5<1)a/=5;
	return __builtin_popcount(a)==1;
}
main()
{
	int m,n;
	while(cin>>m,m)
	{
		cin>>n;int cnt=0;
		for(;m<=n;m++)cnt+=f(m);
		cout<<cnt<<endl;
	}
}

