#include <iostream>
#include <string>
using namespace std;

int main()
{
    string n;
    cin >> n;
    long long counter=0;
    for(int i=0;i<n.length();i++){
        switch (n[i])
            {
                case '1': counter += 1;
                    break;
                case '2': counter += 1;
                    break;
                case '3': counter += 2;
                    break;
                case '4': counter += 2;
                    break;
                case '5': counter += 1;
                    break;
                case '6': counter += 2;
                    break;
                case '7': counter += 2;
                    break;
                case '8': counter += 3;
                    break;
                case '9': counter += 3;
                    break;
                
            }
    }
    cout << counter << endl;

    return 0;
}