#include <bits/stdc++.h>

#define endl "\n"

using namespace std;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    string s; cin >> s;
    int ans=0;
    for(auto x:s) {
        if(x=='0')
            continue;
        if(x=='1' || x=='2' || x=='5')
            ans++;
        else if(x=='3' || x=='4' || x=='6' || x=='7')
            ans+=2;
        else
            ans+=3;
    }
    cout << ans << endl;
    return 0;
}