function main(input) {
  const args = input.split(' ');
  const A = parseInt(args[0], 10);
  const B = parseInt(args[1], 10);
  let tmp = A;
  let ans = 0;
  
  while(tmp <= B) {
    ary = tmp.toString().split('');
    if(ary[0] === ary[4] && ary[1] === ary[3]) {
      ans++;
    }
    tmp++;
  }
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));