defmodule Main do def main do n = IO.gets("") |> String.trim |> String.to_integer _ = IO.gets("") IO.stream(:stdio, :line) |> Enum.take(n) |> Enum.map(&String.trim/1) |> Enum.map(&String.to_integer/1) |> Enum.sort |> (fn list -> Enum.at(list, -1) - Enum.at(list, 0) end).() |> IO.puts end end