const fi='dulieu.inp'
fo='kq.txt'
var f1,f2:text;
a:array[1..100]of integer;
i,n,dem,t:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
n:=0;
while not eof(f1) do
begin
n:=n+1;
read(f1,a[n]);
end;
dem:=0;
t:=0;
for i:=1 to n do
if a[i] mod 6=0 then
begin
dem:=dem+1;
t:=t+a[i];
end;
writeln(f2,dem);
writeln(f2,t);
close(f1);
close(f2);
end.