#include <bits/stdc++.h>
using namespace std;
long long k, l, m, n, a, b, c, d, i, s, f;
int main() {
  cin >> n;
  while (n > 0) {
    a = n % 10;
    if (a == 4 || a == 7) k++;
    n = n / 10;
  }
  if (k == 4 || k == 7)
    cout << "YES";
  else
    cout << "NO";
}
