import java.util.*;
import java.lang.*;

public class Zadatak {

    public static void main(String[] args) {
     Scanner o = new Scanner(System.in);
        long b=0,c,k,V = o.nextLong(),j;
        j=(String.valueOf(V).length());
        for(k=j;k >= 0; k--) {
            c = (long) (V / Math.pow(10, k - 1));
            V = (long) (V % Math.pow(10, k - 1));
            if (c==1||c==2||c==5){
                b+=1;
            }
            else if(c==3||c==4||c==6||c==7){
                b+=2;
            }
            else if(c==8||c==9){
                b+=3;
            }
        }
        System.out.println(b);
    }
}