#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
    long long int n;
    int suma = 0, x;
    scanf("%d",&n);
    while (n > 0)
    {
        x = n % 10;
        switch (x)
        {
        case 8:
        case 9:
            suma += 3;
            break;
        case 3:
        case 4:
        case 6:
        case 7:
            suma += 2;
            break;
        case 1:
        case 2:
        case 5:
            suma += 1;
            break;
        default:
            break;
        }
        n /= 10;
    }
    printf("%d", suma);
    return 0;
}