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