#include <bits/stdc++.h>
using namespace std;
int main() {
  int len, j, a = 0;
  char A[20];
  cin >> A;
  len = strlen(A);
  for (j = 0; j < len; j++) {
    A[j] = A[j] - '0';
    if (A[j] == 4 || A[j] == 7) a++;
  }
  if (a == 4 || a == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
