#include <iostream>
using namespace std;

int main()
{
    long long int v, n = 0;
    cin >> v;
    for ( int c = 0; v > 0; )
    {
        c = v % 10;
        if ( c == 1 || c == 2 || c == 5)
        {
            n++;
        }
        else if ( c == 3 || c == 4 || c == 6 || c == 7 )
        {
            n = n + 2;
        }
        else if ( c == 8 || c == 9 )
        {
            n = n + 3;
        }
        v = v / 10;
    }

    cout << n;

    return 0;
}