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


int main()
{
    long long int v,m,e,db=0;// m a maradek az e az egesz osztas
    scanf("%lli", &v);
    do
    {
        m=v%10;
        e=v/10;
    switch (m)
        {
        case 0 :
            db=db+0;break;
        case 1 :
            db=db+1;break;
        case 2 :
            db=db+1;break;
        case 3 :
            db=db+2;break;
        case 4 :
            db=db+2;break;
        case 5 :
            db=db+1;break;
        case 6 :
            db=db+2;break;
        case 7 :
            db=db+2;break;
        case 8 :
            db=db+3;break;
        case 9 :
            db=db+3;break;
            }


        v=e;
    }
    while (e!=0);
    printf("%lli", db);

    return 0;
}