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