#include <bits/stdc++.h>

using namespace std;
long long V,n,res;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> V;
    res = 0;
    while(V){
        n = V % 10;

        if(n == 1 || n == 2 || n == 5)
            res++;

        else if(n == 3 || n == 4 || n == 6 || n == 7)
            res += 2;

        else if(n == 8 || n == 9)
            res +=3;

        V = V/10;
    }
    cout << res;
    return 0;
}