#include <iostream>
#include <string>
#include <sstream>
using namespace std;

string s;

int brojac(int id)
{
  switch (s[id])
  {
    case '0':
    return 0;
    case '1':
    return 1;
    case '2':
    return 1;
    case '5':
    return 1;
    case '8':
    return 3;
    case '9':
    return 3;
    default:
    return 2;
  }
}

int main()
{
  long long V, br = 0;
  cin >> V;
  stringstream ss;
  ss << V;
  s = ss.str();
  for(int i = 0; i < s.length(); i++)
  {
    br += brojac(i);
  }
  cout << br << endl;
  return 0;
}