defmodule Main do def main do _ = IO.gets("") |> String.trim |> String.to_integer a = IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) ans_min = Enum.zip(tl(a), a) |> Enum.map(fn {x, y} -> x - y end) |> Enum.reduce(&min/2) ans_max = List.last(a) - List.first(a) IO.puts "#{ans_min}\n#{ans_max}" end end