PROGRAM radipetlja11 ;
var
  x,k,v:int64;
begin
read(v) ;
k:=0;
while (v<>0) do
      begin
      x:=V MOD 10 ;
if (x>+5) then
     while (x>=5)  do
            begin
            x:=x-5;
            k:=k+1;
            end;
 if (x>=2) then
       while (x>=2) do
              begin
              x:=x-2;
              k:=k+1;
              end;
    if (x>=1) then
         while (x>=1) do
              begin
              x:=x-1;
              k:=K+1;
              end;
       v:=v div 10;
      end;
      write(k);
  END.