#include<bits/stdc++.h>

#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair

using namespace std;

int a[10];

int resi(ll s)
{
    int res = 0;
    while(s > 0)
    {
        int cif = s % 10;
        s /= 10;
        res += a[cif];
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    a[0] = 0;
    a[1] = 1;
    a[2] = 1;
    a[3] = 2;
    a[4] = 2;
    a[5] = 1;
    a[6] = 2;
    a[7] = 2;
    a[8] = 3;
    a[9] = 3;


    ll s;
    cin >> s;
    cout << resi(s);



    return 0;
}