#include <bits/stdc++.h>
using namespace std;
int s[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
int a, b, z = 0;
cin >> a >> b;
for(int y = a / 10000; y <= b / 10000; y ++)
{
for(int i = 1; i <= 12; i ++)
{
for(int j = 1; j <= s[i]; j++)
{
int _time = y * 10000 + i * 100 + j;
string stime = to_string(_time);
reverse(stime.begin(), stime.end());
int time_ = stoi(stime);
if(_time == time_)
{
z ++;
}
}
}
}
cout << z << endl;
return 0;
}