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