(* O(n) *)
let rec fold_btw f a i n = if i >= n then a else fold_btw f (f a i) (i + 1) n

(* O(n^2) *)
let solve n a_s =
  let a_s = Array.of_list a_s in
  fold_btw
    (fun acc_i i ->
      fold_btw
        (fun acc_j j ->
          max acc_j (abs (a_s.(i) - a_s.(j))))
          acc_i
        (i + 1)
        n)
    0
    0
    n

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  let n = read_int () in
  read_ints () |> solve n |> string_of_int |> print_endline