Var A: array [1..n] of integer;
i, n, min, max: integer;
Begin
Readln(n);
For i:=1 to n do
Readln(a[i]) ;
Min:=a[1];
Max:=a[1];
For i:=1 to n do begin
If a[i]>Max then max:=a[i];
If a[i] <min the min:a[i];
End;
Writeln(max-min)
End.
Var A: array [1..n] of integer;
i, n, min, max: integer;
Begin
Readln(n);
For i:=1 to n do
Readln(a[i]) ;
Min:=a[1];
Max:=a[1];
For i:=1 to n do begin
If a[i]>Max then max:=a[i];
If a[i] <min the min:a[i];
End;
Writeln(max-min)
End.