main(z,t){char n[64];while(gets(n)){t=0;for(z=0;n[z];)switch(n[z++]-48){case 0:t++;break;case 6:t++;break;case 8:t++;case 9:t++;}printf("%d\n",t);}}