n = gets.chomp.to_i a = gets.chomp.split(" ").map(&:to_i).sort i,j,sa = 0,1,[] while j < n sa << a[j] - a[i] i += 1 j += 1 end puts sa.min < 0 ? -sa.min : sa.min puts a[-1] - a[0]