#include <bits/stdc++.h>
bool isLucky(const int& a) {
  int n = a;
  if (n == 0)
    return 0;
  else if (n == 4 || n == 7)
    return 1;
  else
    while (n) {
      if (n % 10 != 4 || n % 10 == 7) return 0;
      n /= 10;
    }
  return 1;
}
int main() {
  long long int n = 0;
  std::cin >> n;
  bool lucky = isLucky(n);
  int count = 0;
  while (n) {
    if (n % 10 == 4 || n % 10 == 7) count++;
    n /= 10;
  }
  bool test = isLucky(count);
  if (isLucky(count) && !lucky)
    std::cout << "YES";
  else
    std::cout << "NO";
}
