#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  ;
  while (t--) {
    long long int n, m, r, count = 0;
    cin >> n;
    m = n;
    while (m) {
      r = m % 10;
      if (r == 4 || r == 7) {
        count++;
      }
      m = m / 10;
    }
    int flag = 0;
    if (count == 4 || count == 7)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
