#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  int count = 0;
  string l;
  l = to_string(n);
  for (int i = 0; i < l.length(); i++) {
    if (l[i] == '4' || l[i] == '7') {
      count++;
    }
  }
  if (count == 7 || count == 4) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
  return 0;
}
