#include <iostream>
using namespace std;
int main(){
    int s=0,a[] = {0,1,1,2,2,1,2,2,3,3};
    long long n;
    cin>>n;
    while(n>0)
    {
        s += a[n%10];
        n /= 10;
    }
    cout<<s;
}