let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let mx = Array.fold_left max arr.(0) arr in
  let mn = Array.fold_left min arr.(0) arr in
  Printf.printf "%d\n" (mx-mn)