#include<stdio.h>
int main(){
int beg,end;
int ans=0;
int m[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
scanf("%d%d",&beg,&end);
int a,b,flag=0;
a=beg/10000;
b=end/10000;
for(int i=a;i<=b;i++){
int tmp=i;
flag=0;
while(tmp>0){
flag=flag*10+tmp%10;
tmp/=10;
}
if(tmp/100<=12&&tmp/100>=1){
if(tmp%100>0&&tmp%100<=m[tmp/100])
ans++;
}
}
printf("%d",ans);
return 0;
}