#include<iostream>
#include<cmath>
using namespace std;
int main()
{   long long h;
    long d,k,t,a,v,n,m,p,v1,t1,w;
    p=0;
    m=0;
    cin>>h;
    t=h/1000000000;
    t1=t;
    v=h%1000000000;
    v1=v;
    while(t1!=0)
    {
        m++;
        t1/=10;
    }
        while(v1!=0)
    {
        w++;
        v1/=10;
    }
    for (n=1;n<=m;n++)
    {
        a=t%10;
        t/=10;
        switch(a)
        {
            case 1:
            p+=1;
            break;
             case 2:
            p+=1;
            break;
             case 3:
            p+=2;
            break;
             case 4:
            p+=2;
            break;
             case 5:
            p+=1;
            break;
             case 6:
            p+=2;
            break;
             case 7:
            p+=2;
            break;
             case 8:
            p+=3;
            break;
             case 9:
            p+=3;
            break;
        }
    }
     for (n=1;n<=w;n++)
    {
        a=v%10;
        v/=10;
        switch(a)
        {
            case 1:
            p+=1;
            break;
             case 2:
            p+=1;
            break;
             case 3:
            p+=2;
            break;
             case 4:
            p+=2;
            break;
             case 5:
            p+=1;
            break;
             case 6:
            p+=2;
            break;
             case 7:
            p+=2;
            break;
             case 8:
            p+=3;
            break;
             case 9:
            p+=3;
            break;
        }
    }
    cout<<p;
}