var min.max:longint;
procedure nhap;
var i,the,n:longint;
begin
   read(n);
   for i:=1 to n do
      begin
      read(the);
      if the>max then max:=the;
      if the<min then min:=the;
      end;
end;

procedure xuat;
begin
   write(max-min);
end;

begin
min:=maxlongint;
max:=-maxlongint;
nhap;
xuat;
end.