#include <iostream>
#include <string>
using namespace std;
int s=0,x;
string v;
int niz []={0,1,1,2,2,1,2,2,3,3};
int main()
{
    ios_base::sync_with_stdio(false);
    cout.tie(NULL);
    cin.tie(NULL);
    cin>>v;
    while(v!="")
    {
        x=v.back()-48;
        s+=niz[x];
        v.pop_back();
    }
    cout<<s;
}