#include <bits/stdc++.h>
using namespace std;
void fun(long long int n) {
  int count = 0;
  while (n) {
    if (n % 10 == 7 || n % 10 == 4) count++;
    n = n / 10;
  }
  if (count == 0) {
    cout << "NO";
    return;
  }
  while (count) {
    int r = count % 10;
    if (r != 7 && r != 4) {
      cout << "NO";
      return;
    }
    count = count / 10;
  }
  cout << "YES";
  return;
}
int main() {
  long long int n;
  cin >> n;
  fun(n);
  return 0;
}
