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