//isplata
#include <iostream>

using namespace std;

int main()
{
    string x;
    int resenje = 0, v[] = {0, 1, 1, 2, 2, 1, 2, 2, 3, 3};
    cin >> x;
    for (int i = 0; i < x.size(); i++)
    {
        char a = x[i];
        resenje += v[a-'0'];
    }
    cout << resenje << endl;
    return 0;
}