uses crt;
var a:array[1..100]of integer;
i,n,t,t1,dem,dem1,min,tam,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t:=t+a[i];
writeln('Tong cac phan tu le la: ',t);
t1:=0;
for i:=1 to n do
if i mod 2=1 then t1:=t1+a[i];
writeln('Tong cac phan tu o vi tri le la: ',t1);
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i]<0 then inc(dem);
if a[i]>0 then inc(dem1);
end;
writeln('Trong day co ',dem,' phan tu am');
writeln('Trong day co ',dem1,' phan tu duong');
min:=a[1];
for i:=2 to n do
if min>a[i] then min:=a[i];
writeln('Phan tu nho nhat la: ',min);
writeln('Vi tri la: ');
for i:=1 to n do
if min=a[i] then write(i:4);
writeln;
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('Mang sau khi sap xep tang dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.