#include <bits/stdc++.h>
using namespace std;
int main() {
  char n[10 ^ 18];
  int x = 0, rem;
  cin >> n;
  long long int i, c = 0;
  for (i = 0; n[i] != '\0'; i++) {
    if (strchr("47", n[i])) c += 1;
  }
  if (c == 0) x = 1;
  for (i = 0; c != 0; i++) {
    rem = c % 10;
    c = c / 10;
    if (rem != 4 && rem != 7) x = 1;
  }
  if (x == 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
