program lentai;
var a:string;
    i,j:integer;
begin
 cls;
 readln(a);
 for i:=1 to length(a) do if a[i]='5' then j:=j+1;
 writeln(j);
end.