let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let f m a = Array.fold_left (fun m b -> max m @@ abs @@ a - b) m a_s
let _ = Array.fold_left f 0 a_s |> Printf.printf "%d\n"