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

function Main(args){
    var input = args.split(' ');
    var A = parseInt(input[0], 10);
    var B = parseInt(input[1], 10);
    var count = 0;

    for(var i=A; i<=B; i++){
        var tmp = i.toString();
        (tmp[0]===tmp[4] && tmp[1]===tmp[3]) ? count++ : '';
    }

    console.log(count);
}