var n,i,k,a: integer;
begin
readln(n);
k:=0;
for i:=1 to n do begin
readln (a);
if (a div 3 <> 0) and (a mod 10 = 2) then
k:=k+1;
end;
writeln(k);
end.
var n,i,k,a: integer;
begin
readln(n);
k:=0;
for i:=1 to n do begin
readln (a);
if (a div 3 <> 0) and (a mod 10 = 2) then
k:=k+1;
end;
writeln(k);
end.