package kusur_reljadjenadic.relja348;

import java.util.Scanner;

public class Kusur_ReljaDjenadicRelja348 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long cena = in.nextLong();
        long cenaCopy = cena; //kopija za menjanje
        long cifre = 1; //brojac cifara
        for (int i = 1; i != 0; i++) { //popunjavanje brojaca
            long ostatak = cenaCopy % 10;
            cenaCopy -= ostatak;
            if (cenaCopy == 0) {
                break;
            }else{
                cenaCopy /= 10;
                cifre++;
            }
        }
        cenaCopy = cena;
        long[] niz = new long[(int)cifre];
        for (int i = (int)cifre-1; i >= 0; i--) {
            niz[i] = cenaCopy % 10;
            cenaCopy /= 10;
        int resenje = 0;
        }
        int resenje = 0;
        
        for (int i = 0; i < niz.length; i++) {
            switch((int)niz[i]){
                case 1: resenje += 1;break;
                case 2: resenje += 1;break;
                case 5: resenje += 1;break;
                case 3: resenje += 2;break;
                case 4: resenje += 2;break;
                case 6: resenje += 2;break;
                case 7: resenje += 2;break;
                case 8: resenje += 3;break;
                case 9: resenje += 3;break;
                case 0: resenje += 0;break;
            }
        }
        System.out.println(resenje);
        
        
        
    }
    
}