let () =
  let n = Scanf.scanf "%d\n" (fun x -> x) in
  let lst = Array.to_list (Array.init n (fun _ -> Scanf.scanf "%d " (fun x -> x))) in
  let max_num = List.fold_left max min_int lst in
  let min_num = List.fold_left min max_int lst in
  Printf.printf "%d\n" (abs (max_num - min_num))
