#include <iostream>

using namespace std;

int main()
{
    unsigned long long int v;
    cin >> v;
    unsigned long long int s;
    int b=0;

    while (v > 0)
    {
        s = v%10;
        if (s==5)
            b++;
        else if (s==2)
            b++;
        else if (s==1)
            b++;
        else if ((s==3) || (s==4)|| (s==6) || (s==7))
            b+=2;
        else if ((s==8) || (s==9))
            b+=3;

        v = v/10;
    }
    cout << b << endl;

    return 0;
}