#include <stdio.h>
#include <stdlib.h>

int main()
{
    int broj,a,b = 0;
    scanf("%i", &broj);
    while(broj>=1){
        a = broj % 10;
        switch(a)
        {
        case 1:
            b++;
            break;
        case 2:
            b++;
            break;
        case 3:
            b += 2;
            break;
        case 4:
            b += 2;
            break;
        case 5:
            b ++;
            break;
        case 6:
            b += 2;
            break;
        case 7:
            b += 2;
            break;
        case 8:
            b += 3;
            break;
        case 9:
            b += 3;
            break;
        }
        broj /= 10;
    }
    printf("%i",b);
}