#include <iostream>
#include <cmath>

using namespace std;

int main(void)
{
    long long int x, x1, novcanice=0;
    cin >> x;

    while(x>0)
    {
        x1=x%10;

        if(x1==0)
            novcanice=novcanice;
        else if(x1==1)
            ++novcanice;
        else if(x1==2)
            ++novcanice;
        else if(x1==3)
            novcanice+=2;
        else if(x1==4)
            novcanice+=2;
        else if(x1==5)
            ++novcanice;
        else if(x1==6)
            novcanice+=2;
        else if(x1==7)
            novcanice+=2;
        else
            novcanice+=3;

        x=x/10;
    }

    cout << novcanice;
    return 0;
}