program baigiai;
uses crt;
var A:array[1..1000] of integer;
n,i,j,tg:integer;
s:longint;
begin
clrscr;
write('Nhap so luong phan tu cua mang: '); readln(n);
d:=0; s:=0;
for i:=1 to n do
begin
write('Phan tu thu ',i,': '); readln(A[i]);
s:=s+A[i];
end;
write('a) Mang theo chieu nguoc la: ');
for i:=n downto 1 do
write(A[i],' ');
writeln;
write('b) Mang sau khi sap xep giam dan la: ');
for i:=1 to n-1 do
for j:=i+1 to n do
if A[i]<A[j] then
begin
tg:=A[i];
A[i]:=A[j];
A[j]:=tg;
end;
for i:=1 to n do
write(A[i],' ');
writeln;
write('c) Cac phan tu chia het cho 2 va 5 la: ');
for i:=1 to n do
if (A[i] mod 2=0) and (A[i] mod 5=0) then write(A[i],' ');
writeln;
write('Tong cac phan tu cua mang la: ',s);
readln
end.