let input_int_array n =
	Array.init n (fun _ -> Scanf.scanf "%d " (fun v -> v))
let get_int () = Scanf.scanf "%d " (fun v -> v)

let () =
  let n = get_int ()
  in let a = input_int_array n
  in Array.sort Pervasives.compare a;
  a.(Array.length a - 1) - a.(0)
  |> string_of_int |> print_endline
