#include <iostream>
using namespace std;
int main(){
    string s;cin>>s;
    int ans = s.size()+2;
    for(int i = 0; s.size() > i; i++){
        if(s[i] == '8')ans+=2;
        if(s[i] == '0' || s[i] == '4' || s[i] == '6' || s[i] == '9')ans++;
    }
    cout << ans << endl;
}