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