n = gets.to_i a = gets.split.map(&:to_i) puts a.each_cons(2).map { |a, b| b - a } .min puts a[-1] - a[0]