#include <bits/stdc++.h>
using namespace std;
int main() {
  long long s;
  scanf("%I64d", &s);
  long long d = s;
  int n = 0;
  while (s > 0) {
    d /= 10;
    d *= 10;
    int a = s - d;
    if (a == 4 || a == 7) {
      n++;
    }
    s /= 10;
    d = s;
  }
  if (n == 0) {
    printf("NO");
    return 0;
  }
  d = n;
  while (n > 0) {
    d /= 10;
    d *= 10;
    int a = n - d;
    if (a != 4 && a != 7) {
      printf("NO");
      return 0;
    }
    n /= 10;
    d = n;
  }
  printf("YES");
}
