var i,a,k:integer;
begin
k:=0;
for i:=1 to 8 do
readln (a);
if a = 3 then k:=k+1
end;
writeln (k)
end.
var i,a,k:integer;
begin
k:=0;
for i:=1 to 8 do
begin
readln (a);
if a = 3 then k:=k+1
end;
writeln (k)
end.