let rec select acc trace = function
  | [] -> acc
  | x :: xs -> select ((trace, x, xs) :: acc) (x :: trace) xs
let select xs = select [] [] xs

let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in
  get

let () =
  let n, z, w = Scanf.scanf "%d %d %d\n" (fun n z w -> n, z, w) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let solve = memoize n (fun self (x, ys) ->
    select ys
    |> List.map (function
        | (_, y, []) -> (abs (x - y), abs (x - y))
        | (_, y, xs) -> self (y, xs))
    |> List.fold_left (fun (z, w) (x, y) -> (max z x, min w y)) (min_int, max_int)) in
  Printf.printf "%d\n" @@ fst @@ solve (w, Array.to_list as_)