#include<iostream>

using namespace std;

int main()
{
    long long int v, s = 0;
    int a;
    
    cin >> v;
    
    while(v)
    {
        a = v % 10;

        if(a == 1 || a == 2 || a == 5)
        {
          s+=1;
        }
        else if(a == 3 || a == 4 || a == 6 || a == 7)
        {
          s+=2;
        }
        else if(a == 8 || a == 9)
        {
          s+=3;
        }

        v = v / 10;
    }

    cout << s << endl;

    return 0;
}