#include <iostream>
using namespace std;
int n;
int m;
int month[13]={0,31,30,31,30,31,30,31,31,30,31,30,31};
int ans=0;
bool huiwen(int n){
int y=n;
int temp=0;
while(y){
temp*=10;
temp+=y%10;
y/=10;
}
if(temp==n) return 1;
else return 0;
}
int main(){
cin>>n>>m;
for(int i=n;i<=m;i++){
if(!huiwen(i)) continue;
int temp=i;
int m=temp/100%100;
if(m<=12&&month[m]>=temp%100){
ans++;
}
}
cout<<ans;
return 0;
}