var c:integer;
begin
c:=0;
var s:=readstring();
for var i:=1 to length(s) do if (s[i]='5') then c:=c+1;
write(c);
end.