(require '[clojure.string :as str])

(let [n (Long/parseLong (read-line))]
   (let [as (map (fn [a] (Long/parseLong a)) (str/split (read-line) #" "))]
      (print (- (apply max as) (apply min as)))
      (newline)
      ))