(* O(b log b) *)
Scanf.scanf "%d %d" @@ fun a b ->
  let string_rev s = let n = String.length s in String.init n @@ fun i -> s.[n - i - 1] in
  let ans = ref 0 in
  for n = a to b do
    let s = string_of_int n in
    if string_rev s = s then incr ans
  done;
  Printf.printf "%d\n" !ans