#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long v;
    scanf("%I64d", &v);
    int c=0;
    long long k=1;
    for(int i=0;i<18;i++)
    {
        long long a;
        a=v/k;
        a=a%10;
        //printf("%I64d ", a);
        switch(a){
        case 1: case 2: case  5:
            c++;
            break;
        case 3: case 4: case 6: case 7:
            c+=2;
            break;
        case 8: case 9:
            c+=3;
            break;
        }


        k=k*10;
    }
    printf("%d", c);
    return 0;
}