#include <bits/stdc++.h>
using namespace std;
long long int dif(long long int q, long long int w) {
  if (q % w == 0)
    return q / w;
  else
    return q / w + 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, h = 0;
  string s;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    if (s[i] == '7' || s[i] == '4') h++;
  }
  if (h == 4 || h == 7)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
