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