var a, count: integer; begin
count := 0; readln(a); while a <> 0 do begin if (a mod 5 = 0) or (a mod 9 = 0) then count := count + 1; readln(a); end; writeln(count);
end.