import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;
import std.range;

void main() {
	auto ip = readln.split.to!(int[]), A = ip[0], B = ip[1];
	uint r = A / 1000;
	uint p = A.to!string[2].to!uint - '0';
	uint s = r*1000 + p*100 + r;
	uint count;
	while(s <= B) {
		count++;
		if(p == 9) {
			p = 0;
			r++;
		}
		else p++;


		s = r*1000 + p*100 + r;
	}
	count.writeln;
}
