#include <iostream>

using namespace std;

int proveri(int v){
    int br = 0;
    if(v == 0) br = 0;
    else if(v == 1) br = 1;
    else if(v == 2) br = 1;
    else if(v == 3) br = 2;
    else if(v == 4) br = 2;
    else if(v == 5) br = 1;
    else if(v == 6) br = 2;
    else if(v == 7) br = 2;
    else if(v == 8) br = 3;
    else if(v == 9) br = 3;
    return br;
}

int main()
{
    int br = 0, m = 0;
    long long v;
    cin >> v;

    while(v > 0){
        m = v%10;
        br += proveri(m);
        v /= 10;
    }

    cout << br;
    return 0;
}