uses crt;
var a: array[1..100] of integer;
i,n,j: integer;
t: real;
begin
clrscr;
write ('nhap so phan tu: '); readln (n);
for i:=1 to n do
begin
write ('nhap so thu ',i,': '); readln (a[i]);
end;
write ('so chan trong day: ');
for i:=1 to n do if a[i] mod 2=0 then write (a[i],' ');
write ('so le trong day: ');
for i:=1 to n do if a[i] mod 2<>0 then write (a[i],' ');
writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]<a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
write ('mang theo thu tu giam dan: ');
for i:=1 to n do write (a[i],' ');
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
write ('mang theo thu tu tang dan: ');
for i:=1 to n do write (a[i],' ');
readln;
end.