#include<iostream>
using namespace std;
int niz[20] = {0, 1, 1, 2, 2, 1, 2, 2, 3, 3};
int main()
{
    string a;
    cin>>a;
    int mn = 0;
    for(int i=0;i<a.size();i++)
    {
        int b = a[i] - '0';
        mn += niz[b];
    }
    cout<<mn;
    return 0;
}