program Project1;
var
  v,x,k,i,y,c,z,q:integer;
  d:array[1..3] of integer;
begin
  readln(v);
  d[1]:=1;
  d[2]:=2;
  d[3]:=5;
  x:=1;
  y:=1;
  c:=0;
  while v>0 do
  begin
  q:=v;
  while q>1 do
  begin
  q:=q div 10;
  c:=c+1;
  end;
  k:=c-1;
  for i:=1 to k do
  y:=y*10;
  for i:=3 downto 1 do
  begin
  z:=d[i]*y;
  if v>z then x:=x+1;
  end;
  v:=v-z;
  end;
  writeln(x);
  readln;
end.