var n,i,mi,ma:longint;
        a:array[1..100] of longint;
begin

        readln(n);
        for i:=1 to n do read(a[i]);
        mi:=a[1];ma:=a[1];
        for i:=1 to n do
                if mi>a[i] then mi:=a[i];
        for i:=1 to n do
                if mi<a[i] then mi:=a[i];
        writeln(ma-mi);
end.