#include <iostream>
using namespace std;
int palindrom(int x)
{
int ogl=0, k=x;
while (k)
{
ogl=ogl*10+k%10;
k/=10;
}
if (ogl==x) return 1;
else return 0;
}
int main()
{
int a, b, num, contor=0;
cin >> a >> b;
if (a>b) swap(a,b);
num=a;
while (num<=b)
{
if (palindrom(num)) ++contor;
++num;
}
cout << contor;
return 0;
}