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

int main()
{
    int v, vc;
    int counter = 0;
    int c;

    scanf("%d",&v);
    if(v <1 || v >= pow(10,18))
    {
        return 0;
    }
    vc = v;
    int digit = 0;

    while(vc != 0)
    {
        counter++;
        vc /= 10;
    }
    c = counter;
    vc = v;
    int num[counter];
    for(int i=0; i<counter; i++)
    {
        num[i] = vc%10;
        vc = vc/10;
    }
    if(v > 0)
    {
        for(int i = 0; i<counter; i++)
        {
            if(num[i] == 1)
            {

                    digit++;

            }
            else if(num[i] == 2)
            {

                    digit++;


            }
            else if(num[i] == 3)
            {

                    digit += 2;

            }
            else if(num[i] == 4)
            {

                    digit += 2;

            }
            else if(num[i] == 5)
            {

                    digit++;


            }
            else if(num[i] == 6)
            {

                    digit += 2;

            }
            else if(num[i] == 7)
            {

                    digit += 2;

            }
            else if(num[i] == 8)
            {

                    digit += 3;

            }
            else if(num[i] == 9)
            {
                    digit += 3;
            }
            else
            {

            }
            c--;
        }
    }

    printf("%d",digit);
    return 0;
}