var
i, n, min, max: integer;
arr: array[integer] of integer;
begin
readln(n);
read(arr[0]);
min := arr[0];
for i := 1 to n-1 do
read(arr[i]);
if arr[i] < min then min := arr[i];
end;
max := min;
for i := 0 to n-1 do
if arr[i] > max then max := arr[i];
writeln(max-min);
end.
var
i, n, min, max: integer;
arr: array[integer] of integer;
begin
readln(n);
read(arr[0]);
min := arr[0];
for i := 1 to n-1 do
begin
read(arr[i]);
if arr[i] < min then min := arr[i];
end;
max := min;
for i := 0 to n-1 do
if arr[i] > max then max := arr[i];
writeln(max-min);
end.