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