#include <bits/stdc++.h>
using namespace std;
bool Caps(string a) {
  for (int i = 0; i < a.size(); i++)
    if (a.at(i) < 65 && a.at(i) > 90) return false;
  return true;
}
int main() {
  long long n, cnt = 0;
  cin >> n;
  while (n > 0) {
    int rem = n % 10;
    if (rem == 4 || rem == 7) {
      cnt++;
    }
    n /= 10;
  }
  if (cnt == 4 || cnt == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
