#include <iostream>

using namespace std;

int provera(int cifra)
{
    int vrati=2;
    switch(cifra)
    {
        case 1: vrati=1;
        break;
        case 2: vrati=1;
        break;
        case 5: vrati=1;
        break;
        case 8: vrati=3;
        break;
        case 9: vrati=3;
        break;
        case 0: vrati=0;
        break;
        default: vrati=2;

    }

    return vrati;
}


int main()
{
    unsigned long long V;
    cin >> V;
    int brojac=0;
    while(V>=10)
    {
        brojac+=provera(V%10);
        V/=10;
    }
    brojac+=provera(V%10);
    cout << brojac;
}