#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0, k = 0, i, j;
  long long n;
  cin >> n;
  int l = 0;
  while (n > 0) {
    if (n % 10 == 4 || n % 10 == 7) l++;
    n /= 10;
  }
  if (l == 0) {
    printf("NO");
    return 0;
  }
  while (l > 0) {
    if (l % 10 != 4 && l % 10 != 7) {
      cout << "NO";
      return 0;
    }
    l = l / 10;
  }
  cout << "YES" << '\n';
}
