#include<stdio.h>

int main(){

int x,y,c=0;
bool f[1000001];
for(int i=0;i<=1000001;i++)
	f[i]=false;
for(int i=0;i<=1000001;i++)
{
if(i%2==0)f[i]=true;
else if(i%3==0)f[i]=true;
else if(i%5==0)f[i]=true;
}

while(scanf("%d %d",&x,&y)!=EOF)
{
	for(int i=x;i<=y;i++)
{if(f[i]==true)c++;
	}
	
	
	/*
for(int i=x;i<=y;i++)
{
if(i%2==0)c++;
else if(i%3==0)c++;
else if(i%5==0)c++;
}
*/
printf("%d\n",c);c=0;
}
return 0;
}