#include <iostream>

using namespace std;

int pc(int c)
{
    if((c == 1)|| (c == 2) || (c == 5))
    {
        return 1;
    }
    else if((c == 3)|| (c == 4) || (c == 6) || (c == 7))
    {
        return 2;
    }
    else if(c == 0)
    {
        return 0;
    }
    else
    {
        return 3;
    }
}

int main()
{
    long long v, c, b=0;
    cin >> v;

    while(v != 0)
    {
        c = v%10;
        v = v/10;
        b += pc(c);
    }

    cout << b << endl;
    return 0;
}