#include <bits/stdc++.h>
using namespace std;
int main() {
  int ctr = 0, i, j, flag = 0;
  string x;
  cin >> x;
  for (i = 0; i < x.length(); i++) {
    if (x[i] == '4' || x[i] == '7') ctr++;
  }
  j = ctr;
  while (j != 0) {
    i = j % 10;
    j /= 10;
    if (i == 4 || i == 7)
      continue;
    else {
      flag = 1;
      break;
    }
  }
  if (flag == 1 || ctr == 0)
    cout << "NO\n";
  else
    cout << "YES\n";
}
