Uses crt;
const m=5;
n=5;
var a:array[1..n,1..m] of integer;
i,j,min,max:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do
read(a[i,j]);
end;
writeln;
min:=100;
max:=0;
for i:=1 to n do
for j:=1 to m do
begin
if a[i,j]if a[i,j]>max then max:=a[i,j];
end;
write(max-min);
end.