#include <stdio.h>

int main() {
    char a[1000000];
    int x = 0;
    for(int i = 0;i<1000000;i++){
        scanf("%c",&a[i]);
        if(a[i]>='0' && a[i]<='9'){
        if(a[i]=='0'||a[i]=='6'||a[i]=='9'){
               x = x+1;
        }
        else if(a[i]=='8'){
            x = x+2;
        }
        }
        else {
        break;
        }
    }
    printf("%d",x);
    return 0;
}