#include <bits/stdc++.h> using namespace std; int main (){ int X,g,z=0; cin>>X; while(X!=0){ g=X%10; X/=10; if(g==2||g==6||g==9||g==0){ z+=1; } if(g==8){ z+=2; } } cout<<z; }