#include <bits/stdc++.h>
int main() {
  char n[100];
  scanf("%s", n);
  int l = strlen(n);
  int t = 0;
  for (int i = 0; i < l; i++) {
    if (n[i] == '4' || n[i] == '7') {
      t += 1;
    }
  }
  if (t == 4 || t == 7) {
    printf("YES");
  } else {
    printf("NO");
  }
}
