#include <iostream>

using namespace std;

int main()
{
    int v,br=0;
    cin>>v;
    int x=v;
    int d=1;
    while(x/d != 0)
    {
        int c;
        c=(x/d)%10;
        switch(c)
        {
        case 1:case 2:case 5:br+=1;break;
        case 3:case 4:case 6:case 7:br+=2;break;
        case 8:case 9:br+=3;
        }
        d*=10;
    }
    cout<<br<<endl;
    return 0;
}