#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; unordered_map<int,int>p; p['0']=p['6']=p['9']=1; p['8']=2; int ans=0; for(char& c:s){ ans+=p[c]; } cout<<ans; }