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