#include <bits/stdc++.h>
using namespace std;
vector<int> values;
int main() {
  string inp;
  int count = 0;
  cin >> inp;
  for (int i = 0; i < inp.length(); i++) {
    if (inp[i] == '4' || inp[i] == '7') count++;
  }
  if (count == 4 || count == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
