#include <iostream>

using namespace std;

int main()
{
    int br=0, x;
    int64_t n;
    cin>>n;
    while(n>0)
    {
        x=n%10;
        if(x==0)
            br+=0;
        else if(x==8||x==9)
                br+=3;
            else if(x==1||x==2||x==5)
                    br+=1;
                else
                    br+=2;
        n/=10;
    }
    cout<<br;
}