#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int i, t;
  char str[25];
  while (~scanf("%s", str)) {
    int len = strlen(str);
    t = 0;
    for (int i = 0; i < len; i++) {
      if (str[i] == '4' || str[i] == '7') {
        t++;
      }
    }
    if (t == 4 || t == 7)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
