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