#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  int c = 0, d;
  cin >> n;
  while (n) {
    d = n % 10;
    n = n / 10;
    if (d == 4 || d == 7) c++;
  }
  if (c == 4 || c == 7 || c == 14)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
