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