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