#include <iostream>

using namespace std;

int mini(long long n)
{
    if(n==1 || n==2 || n==5)
        return 1;
    else if(n==3 || n==4 || n==6 || n==7)
        return 2;
    else if(n==8 || n==9)
        return 3;
    else
        return 0;
}

int main()
{
    long long n;
    int zbir=0,cif;
    cin>>n;
    while(n>9)
    {
        cif=n%10;
        zbir+=mini(cif);
        n=n/10;
    }
    zbir+=mini(n%10);
    cout<<zbir<<endl;
}