let is_palin s =
    let rec aux s lindex rindex =
        if lindex > rindex then false
        else if lindex = rindex then true
        else if s.[lindex] = s.[rindex] && aux s (lindex + 1) (rindex - 1) then true
        else false
    in aux s 0 (String.length s - 1)

let rec solve a b =
    if a > b then 0
    else if is_palin (string_of_int a) then
        1 + solve (a + 1) b
    else
        solve (a + 1) b

let () =
    Scanf.scanf "%d %d" (fun a b ->
        Printf.printf "%d\n" (solve a b)
    )
