Var A,N,k:integer;
Begin
ReadLn(N);
k:=0;
For N:= 1 to N do
Read(A);
if (A mod 3 = 0)and(Abs(A) mod 10 = 2) then k:=k+1
End;
WriteLn(k)
End.
Var A,N,k:integer;
Begin
ReadLn(N);
k:=0;
For N:= 1 to N do
Begin
Read(A);
if (A mod 3 = 0)and(Abs(A) mod 10 = 2) then k:=k+1
End;
WriteLn(k)
End.