Uses crt;
Var a:array[1..10000] of longint;
n,i,tam,j,s,max,min: longint;
begin
repeat
clrscr;
write('n = ');
readln(n);
until (n > 0) and (n <= 10000);
for i := 1 to n do
begin
write('a[',i,'] = ');
readln(a[i]);
s:=s+a[i];
end;
writeln('Day so vua nhap la: ');
for i := 1 to n do write(a[i],' ');
writeln;
writeln('Tong cua day so tren la: ',s);
max:=a[1];
min:=a[1];
for i := 2 to n do
begin
if (a[i] > max) then max:=a[i];
if (a[i] < min) then min:=a[i];
end;
writeln('So nho nhat trong day la: ',min);
Writeln('So lon nhat trong day la: ',max);
writeln('Day sau khi sap xep tang dan la: ');
for i := 1 to n-1 do
for j := i+1 to n do
if (a[i] > a[j]) then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
for i := 1 to n do write(a[i],' ');
readln;
end.