uses crt;
var a:array[1..100]of integer;
n,i,tbl,tbc,dem,dem1:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tbc:=0;
tbl:=0;
dem:=0;
dem1:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then
begin
inc(dem);
tbc:=tbc+a[i];
end;
if a[i] mod 2<>0 then
begin
inc(dem1);
tbl:=tbl+a[i];
end;
end;
writeln('Trung binh cong cua cac so chan la: ',tbc/dem:4:2);
writeln('Trung binh cong cua cac so le la: ',tbl/dem1:4:2);
readln;
end.