#include <bits/stdc++.h>
using namespace std;
short isLucky(unsigned long long n) {
  short status = 1;
  if (n == 0) status = 0;
  while (n != 0) {
    if (n % 10 == 4 or n % 10 == 7)
      ;
    else
      status = 0;
    n /= 10;
  }
  return status;
}
int main() {
  unsigned long long n, count = 0;
  cin >> n;
  while (n != 0) {
    if (n % 10 == 4 or n % 10 == 7) count++;
    n /= 10;
  }
  if (isLucky(count))
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
