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