for(;l=readline(x=0);print(x))l.replace(/[6890]/g,function(q){x+=+q==8?2:1});