#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int w = 0;
  int resultt = 0;
  int x = s.length();
  for (int y = 0; y < x; y++) {
    if (s[y] == '4' || s[y] == '7') resultt += 1;
  }
  if (resultt == 7 || resultt == 4)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
