#include <iostream>

using namespace std;

int main()
{   long long V;
    int suma = 0;
    cin>>V;
    long long y = V;
    while (y != 0){
        switch (y % 10) {
        case 0: suma=suma;
        break;
        case 1:
        case 2:
        case 5: suma++;
        break;
        case 3:
        case 4:
        case 6:
        case 7:suma+=2;
        break;
        default: suma+=3;
        break;
        }
        y /= 10;
    }
    cout<<suma;
  return 0;
}