#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll v;
int cifre[10];

int resi(ll x)
{
    int s = 0;
    while(x != 0)
    {
        s+=cifre[x%10];
        x/=10;
    }
    return s;
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    
    cin >> v;
    
    cifre[0] = 0;
    cifre[1] = 1;
    cifre[2] = 1;
    cifre[3] = 2;
    cifre[4] = 2;
    cifre[5] = 1;
    cifre[6] = 2;
    cifre[7] = 2;
    cifre[8] = 3;
    cifre[9] = 3;
    
    cout << resi(v);
    
    return 0;
}