#include <iostream>
using namespace std;
int main ()
{
    long long v,cif;
    int resenje=0;
    cin>>v;
    while (v>0)
    {
        cif=v%10;
        v=v/10;
        if (cif!=0)
        {
            if (cif==1 || cif==2 || cif==5)
                resenje++;
            else if (cif==4 || cif==3 || cif==6 || cif==7)
                resenje=resenje+2;
            else
                resenje=resenje+3;
        }
    }
    cout<<resenje;
    return 0;
}