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