#include <iostream>
using namespace std;
int novac(int x)
{
    int rez;
    switch(x)
    {
        case 0:rez=0;break;
        case 1:rez=1;break;
        case 2:rez=1;break;
        case 3:rez=2;break;
        case 4:rez=2;break;
        case 5:rez=1;break;
        case 6:rez=2;break;
        case 7:rez=2;break;
        case 8:rez=3;break;
        case 9:rez=3;break;
    }
    return rez;
}
int main()
{
    long long x;
    int s=0;
    cin>>x;
    while(x>0)
    {
        s=s+novac(x%10);
        x=x/10;
    }
    cout<<s;
    return 0;
}