// https://atcoder.jp/contests/abc152/tasks/abc152_c

#include <bits/stdc++.h>
using namespace std;

int main()
{
    long a, b;
    cin >> a >> b;
    long ans = 0;
    for (int x = a; x <= b; x++)
    {
        string s, t;
        s = to_string(x);
        t = s;
        reverse(t.begin(), t.end());
        if (s == t)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
	int a, b;
	int c;
	int sum = 0;
	cin >> a >> b;
	c = a;
	for (int i= 0; i < b-a+1; i++)
	{
		if (c/10000 == c-(c/10)*10 && c/1000 - (c/10000)*10 == c/10 - (c/100)*10 )
		{	
		sum += 1;
		c++;
		continue;
		}
		
		else
		{
			c++;
			continue;
		}
		 
	}
	cout << sum << endl;
}