Program bai_tap;
Uses crt;
Var A: array [1..150] of integer;
i, n, j, t, max, min : integer;
Begin
Write ('nhap n=');
Readln (n);
For i:=1 to n do
begin
Write ('nhap phan tu thu ',i,'=');
Readln (A[i]);
end;
For j:=n downto 2 do
For i:=1 to j-1 do
If A[i]> A[i+1] then
begin
t:= A[i];
A[i]:= A[i+1];
A[i+1]:=t;
end;
max:=A[1];
For i:=2 to n do
If max < A[i] then max:= A[i];
min:= A[1];
For i:=2 to n do
If min > A[i] then min:= A[i];
Writeln ('Day do duoc sap xep la:');
For i:=1 to n do Write (A[i]:5);
Writeln;
Writeln ('so lon nhat la:', max);
Writeln ('so be nhat la:', min);
Readln
End.