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