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