#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int ans=0;
    int i;
    for(i=0;i<s.length();i++)
    {
        if(s[i]=='9')ans+=4;
        else
        {
            if(s[i]=='8')ans+=3;
            else
            {
                if(s[i]=='1' || s[i]=='2' || s[i]=='5')ans++;
                else ans+=2;
            }
        }
    }
    cout<<ans;
}