Scanf.scanf "%d %d" @@ fun a b ->
  let ans = ref 0 in
  for x = 1 to 9 do
    for y = 0 to 9 do
      for z = 0 to 9 do
        let n = 10000 * x + 1000 * y + 100 * z + 10 * y + x in
          if a <= n && n <= b then incr ans
      done
    done
  done;
  Printf.printf "%d\n" !ans