#include <bits/stdc++.h>
using namespace std;
long long v1,a[15],rez;
string v;
int main () {
    freopen("upis.txt", "r", stdin);
    freopen("ispis.txt", "w", stdout);
    cin>>v;
    for(int i=0;i<v.size();i++){
        a[v[i]-'0']++;
    }
    a[1]*=1;
    a[2]*=1;
    a[3]*=2;
    a[4]*=2;
    a[5]*=1;
    a[6]*=2;
    a[7]*=2;
    a[8]*=3;
    a[9]*=3;
    for(int i=1;i<=9;i++){
        rez+=a[i];
    }
    cout<<rez<<endl;
    return 0;
}