#include <bits/stdc++.h>
using namespace std;
char code[50];
int main() {
  scanf("%s", code);
  int l = strlen(code);
  int sum = 0;
  for (int i = 0; i < l; i++)
    if (code[i] == '4' || code[i] == '7') sum++;
  if (sum == 4 || sum == 7)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
