let () =
  Scanf.scanf "%d %d\n" @@ fun a b ->
  let ans = ref 0 in
  for num = a to b do
    if num / 10000 = num mod 10 && (num / 1000) mod 10 = (num / 10) mod 10
    then ans := !ans + 1
  done;
  Printf.printf "%d\n" !ans