"use strict";

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v);
  const a = input[0];
  const b = input[1];

  let i = a;
  let ans = 0;
  while (i <= b) {
    if (
      Math.floor(a / 10000) === a % 10 &&
      Math.floor(a / 1000) % 10 === Math.floor(a / 100) % 10
    )
      ans++;

    i++;
  }
  console.log(ans);
}

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