let () =
  let n = Scanf.scanf "%d" (fun x -> x) in
  let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x)) in
  ( Array.fold_left max a.(0) a - Array.fold_left min a.(0) a )
  |> Printf.printf "%d\n"