#include <iostream>
#include <string>

using namespace std;

int main() {
    string v;
    cin >> v;

    int counter = 0;
    for(auto c: v) {
        if(c == '1') counter++;
        else if(c == '2') counter++;
        else if(c == '3') counter += 2;
        else if(c == '4') counter += 2;
        else if(c == '5') counter++;
        else if(c == '6') counter+=2;
        else if(c == '7') counter+=2;
        else if(c == '8')counter += 3;
        else if(c == '9') counter += 3;

    }
    cout << counter << endl;
    
}