#include <bits/stdc++.h>

using namespace std;

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