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