#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

string s;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> s;
    ll sol = 0;
    for(auto f : s){
        if(f == '0'){
            continue;
        }
        if(f == '1' || f == '2' || f == '5'){
            sol++;
        }
        else if(f == '3' || f == '4' || f == '6' || f == '7'){
            sol += 2;
        }
        else{
            sol += 3;
        }
    }
    cout << sol << endl;
}