#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100005;
int main()
{
    string s;
    ll brojac=0;
    cin >> s;
    ll n=s.length();
    for(int i=n-1;i>=0;i--){
        if(s[i] == '1' || s[i] == '2' || s[i] == '5'){brojac++;continue;}
        if(s[i] == '4' || s[i] == '3' || s[i] == '6'){brojac+=2;continue;}
        if(s[i] == '8'||s[i] == '9'){brojac+=3;continue;}
    }
    cout << brojac<< endl;
    return 0;
}