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