var x,y,a:integer;
begin
a:=0;
writeln ('enter x');
read (x);
while x>0 do begin
y:= x mod 10;
if y=5 then
a:=a+1;
x:=x div 10;
end;
writeln(a);
readln;
readln;
end.