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