#include<iostream>
using namespace std;
int main()
{
    long long  v;
    cin >> v;int rez = 0;
    while(v>0)
    {
        int x= v%10;
        v=v/10;
        if(x == 1 || x == 2 || x == 5)
        {
            rez++;
        }
        else if(x == 3 || x == 4 || x == 6 || x ==7)
        {
            rez+=2;
        }
        else
        {
            rez+=3;
        }
    }
    cout << rez;
}