uses crt;
var a:array[1..20]of integer;
i,n,tb,dem:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
tb:=0;
dem:=0;
for i:=1 to n do
if a[i] mod 3=0 then
begin
tb:=tb+a[i];
inc(dem);
end;
writeln('Trung binh cong cac so chia het cho 3 la: ',tb/dem:4:2);
readln;
end.