Program HOC24;
var i,n: integer;
a: array[1..32000] of integer;
t: longint;
begin
write('n='); readln(n);
t:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i] mod 3=0 then t:=t+a[i];
end;
writeln('Tong cac gia tri phan tu chia het cho 3 la : ',t);
for i:=1 to n do write(a[i],' ');
readln
end.