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