#include <bits/stdc++.h>
using namespace std;
int cnt, ans;
int main() {
  string a;
  cin >> a;
  for (int k = 0; k < a.size(); k++) {
    if (a[k] == '4') ans++;
    if (a[k] == '7') cnt++;
  }
  if (ans + cnt == 4 || ans + cnt == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
