const fi='dl.dat'
fo='kq.dat'
var f1,f2:text;
a:array[1..100]of integer;
i,n,dem1,dem2,t1,t2:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem1)
else inc(dem2);
end;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if (a[i] mod 6=0) then t1:=t1+a[i];
if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i];
end;
writeln(f2,dem1,' ',dem2);
writeln(f2,t1);
writeln(f2,t2);
close(f1);
close(f2);
end.
const fi='dl.dat'
fo='kq.dat'
var f1,f2:text;
a:array[1..100]of integer;
i,n,dem1,dem2,t1,t2:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if a[i] mod 2=0 then inc(dem1)
else inc(dem2);
end;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if (a[i] mod 6=0) then t1:=t1+a[i];
if (a[i] mod 9=0) and (a[i] mod 2<>0) then t2:=t2+a[i]
end
writeln(f2,dem1,' ',dem2)
writeln(f2,t1)
writeln(f2,t2)
close(f1)
close(f2)
;-;