uses crt;
var a:array[1..100]of integer;
i,n,dem,s,s1,vt:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
dem:=0;
s:=1;
for i:=1 to n do
if a[i]=3 then
begin
inc(dem);
s:=s*a[i];
end;
writeln('So phan tu bang 3 la: ',dem);
writeln('Tich cua chung la: ',s);
for i:=n downto 1 do
if a[i]<0 then
begin
vt:=i;
break;
end;
if vt=0 then writeln('Trong day khong co so am')
else writeln('So am cuoi cung la: ',a[vt]);
s1:=1;
for i:=1 to n do
if (a[i] mod 3=0) or (a[i] mod 4=0) then s1:=s1*a[i];
writeln('Tich cac phan tu chia het cho 3 hoac 4 la: ',s1);
writeln('Cac so nguyen la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.