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