main(z,t,k){char n[64];while(gets(n)){t=0;for(z=0;n[z];)k=n[z++]-48,!k|k==6|k==9?t++:k==8?t+=2:0;printf("%d\n",t);}}