function Main(input) {
	input = input.split(" ").map(a => parseInt(a));
	var A = input[0];
	var B = input[1];
	
	var ans = 0;
	for(;A<=B;A++){
		if(Math.floor(A / 10000) === A % 10 && Math.floor(A/1000) % 10 === Math.floor(A % 100 / 10)) ans++;
	}
	
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));