uses crt;
var a:array[1..100]of integer;
i,n,max,min,dem,k,t1,t2,tam,j:integer;
{----------chuong-trinh-con-nhap---------------------}
procedure NHAP_mang;
begin
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
end;
{--------------chuong-trinh-con-xuat-mang---------------------}
procedure hien_mang;
begin
for i:=1 to n do
write(a[i]:4);
end;
{------------chuong-trinh-con-tim-min--------------------}
procedure tim_min;
begin
min:=a[1];
for i:=1 to n do
if min>a[i] then min:=a[i];
writeln('So nho nhat la: ',min);
end;
{--------------chuong-trinh-con-tim-max-----------------}
procedure tim_max;
begin
max:=a[1];
for i:=1 to n do
if max<a[i] then max:=a[i];
writeln('So lon nhat la: ',max);
end;
{---------------------chuong-trinh-con-dem-so-k----------------------}
procedure dem_k;
begin
write('Nhap k='); readln(k);
dem:=0;
for i:=1 to n do
if a[i]=k then inc(dem);
writeln('So phan tu bang ',k,' la: ',dem);
end;
{------------------chuong-trinh-con-tinh-tong-so-chan-------------------------}
procedure tong_chan;
begin
t1:=0;
for i:=1 to n do
if a[i] mod 2=0 then t1:=t1+a[i];
writeln(t1);
end;
{------------------chuong-trinh-con-tinh-tong-so-le-----------------------}
procedure tong_le;
begin
t2:=0;
for i:=1 to n do
if a[i] mod 2<>0 then t2:=t2+a[i];
writeln(t2);
end;
{-------------------chuong-trinh-con-sap-xep-mang-khong-giam----------------}
procedure sap_xep;
begin
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]:4);
end;
{-----------------------chuong-trinh-chinh--------------------------}
begin
clrscr;
nhap_mang;
hien_mang;
tim_min;
tim_max;
dem_k;
tong_chan;
tong_le;
sap_xep;
readln;
end.