import std.stdio;
import std.string;
import std.conv;

void main()
{
	auto input = split( readln() );
	int sup = to!int(input[1]), inf = to!int(input[0]);
	
	int i = inf;
	int cnt = 0;
	while (i <= sup) {
		int n1 = i % 10;
		int n2 = (i % 100 - n1) / 10;
		int n3 = (i % 1000 - 10 * n2 - n1) / 100;
		int n4 = (i % 10000 - 100 * n3 - 10 * n2 - n1) / 1000;
		int n5 = (i - 1000 * n4 - 100 * n3 - 10 * n2 - n1) / 10000;
		if (n1 == n5 && n2 == n4) { cnt += 1; }
		i+=1;
	}
	writeln(cnt);
	
}