#include <iostream>
using namespace std;
int main()
{
    long long n;
    int brojac=0;
    cin>>n;
    while(n)
    {
        if(n%10==8||n%10==9) brojac+=3;
        else if(n%10==1) brojac++;
        else if(n%10==2) brojac++;
        else if(n%10==5) brojac++;
        else if(n%10==0) brojac+=0;
        else brojac+=2;
        n=n/10;
    }
    cout<<brojac<<endl;
    return 0;
}