-module('Main').
-export([main/1]).

main(_) ->
    {ok, [N]} = io:fread("", "~d"),
    As = [XX || XX <- lists:map(fun(_) ->
                                        {ok, [X]} = io:fread("", "~d"),
                                        X
                                end,
                                lists:seq(1, N))],
    Ans = lists:foldl(fun(X, Acc) ->
                              Max = lists:max(lists:map(fun(Each) ->
                                                                abs(X - Each)
                                                        end,
                                                        As)),
                              max(Max, Acc)
                      end,
                      0,
                      As),
    io:format("~p~n", [Ans]),
    halt().
