#include <bits/stdc++.h>
int main() {
  char lucky[20];
  while (scanf("%s", lucky) == 1) {
    int i, j, a = 0;
    for (i = 0; lucky[i] != '\0'; i++) {
      if (lucky[i] == '4' || lucky[i] == '7') a++;
    }
    if (a == 4 || a == 7)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
