#include<stdio.h>



int main(){

long big=60*60*60*60;
int x,y;

while(1)
{
int c=0;
scanf("%d",&x);if(x==0)break;

scanf("%d",&y);

for(int i=x;i<=y;i++)
if(big%i==0)c++;

printf("%d\n",c);

}
return 0;
}