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