const
m = 10;
var
arr: array[1..m] of integer;
i, j, k,r: integer;
begin
for i := 1 to m do begin
read (arr[i]);
end;
for i := 1 to m-1 do
for j := 1 to m-i do
if arr[j] > arr[j+1] then begin
k := arr[j];
arr[j] := arr[j+1];
arr[j+1] := k
end;
for i := 1 to m do
write (arr[i]:4);
r:=arr[10]-arr[1];
write (' ',r);
writeln;
readln
end.