#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  int digit, lucky = 0;
  cin >> n;
  while (n != 0) {
    digit = n % 10;
    n = n / 10;
    if (digit == 4 || digit == 7) {
      lucky++;
    }
  }
  if (lucky == 4 || lucky == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
