#include <bits/stdc++.h>
int main() {
  int64_t n;
  std::cin >> n;
  int count = 0;
  while (n != 0) {
    if ((n % 10 == 4 || n % 10 == 7) ? true : false) count++;
    n /= 10;
  }
  if ((count == 4 || count == 7) ? true : false)
    std::cout << "YES";
  else
    std::cout << "NO";
}
