uses crt;
var a:array[1..100]of integer;
n,i,t,j,tam,max:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Day so ban vua nhap la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cua day so la: ',t);
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;
writeln('Day so duoc sap xep tang dan la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
max:=a[1];
for i:=2 to n do
if max<a[i] then max:=a[i];
writeln('Gia tri lon nhat la: ',max);
readln;
end.