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