#include <bits/stdc++.h>
using namespace std;
vector<int> date;
int d[] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
int atoi(string s)
{
return atoi(s.c_str());
}
int main()
{
int cnt = 0;
int a,b;
cin >> a >> b;
for(int i = 1;i <= 12;i++)
{
for(int j = 1;j <= d[i];j++)
{
int num1 = i * 100 + j;
string s = to_string(num1);
reverse(s.begin(),s.end());
if(s.size() == 3) s += "0";
int num = atoi(s) * 10000 + num1;
if(num >= a && num <= b)
{
cnt++;
}
}
}
cout << cnt << endl;
return 0;
}