(defn input []
  (do (read-line)
      (->> (clojure.string/split (read-line) #"\s")
        (map #(Integer/parseInt %)))))



(defn MaximamDifference [As]
  (apply max
    (for [x As
          y As
          :let [d (- x y)]]
      d)))

(-> (input)
  MaximamDifference
  println)