#include <bits/stdc++.h>
using namespace std;
int main() {
  string k;
  cin >> k;
  int c = 0;
  for (int i = 0; i < k.size(); i++) {
    if (k[i] == '4' || k[i] == '7') {
      c += 1;
    }
  }
  if (c == 4 || c == 7) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
  return 0;
}
