Var A, counter: integer; begin readln(A); counter := 0; repeat if (A mod 10 > 6) then inc(counter); A := A div 10; until (A = 0); writeln(counter); end.