#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double PI = 2 * acos(0.0);
const double EPS = 1e-9;
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a > b ? 1 : 2; }
int DI[] = {-1, 0, 1, 0, 1, -1, -1, 1};
int DJ[] = {0, 1, 0, -1, 1, -1, 1, -1};
int main() {
  long long n;
  cin >> n;
  int c = 0;
  while (n) {
    if (n % 10 == 7 || n % 10 == 4) c++;
    n /= 10;
  }
  bool b = (c != 0);
  while (c) {
    if (c % 10 != 7 && c % 10 != 4) {
      b = 0;
      break;
    }
    c /= 10;
  }
  if (b)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
