#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, c = 0;
  string x;
  cin >> x;
  for (i = 0; i < x.size(); i++) {
    if (x[i] == '4' || x[i] == '7') {
      c++;
    }
  }
  if (c == 4 || c == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
