#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  int ans = 0, d;
  while (n) {
    d = n % 10;
    if (d == 4 || d == 7) ++ans;
    n /= 10;
  }
  if (ans == 4 || ans == 7)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
  return 0;
}
