#include <iostream>

using namespace std;

int main()
{
    unsigned long long V, q;
    int  s=0;
    cin>>V;
    while(V!=0)
    {
        q=V%10;
        switch(q)
        {
            case 1:
            case 2:
            case 5:
                s+=1;
                break;
            case 3:
            case 4:
            case 6:
            case 7:
                s+=2;
                break;
            case 8:
            case 9:
                s+=3;
        }
        V/=10;
    }
    cout<<s;

    return 0;
}