#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
inline void solve() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int lucky = 0;
  for (auto const &c : s) lucky += c == '4' || c == '7';
  bool is_lucky = lucky > 0;
  while (lucky) {
    int x = lucky % 10;
    if (!(x == 4 || x == 7)) is_lucky = false;
    lucky /= 10;
  }
  cout << (is_lucky ? "YES" : "NO");
  return 0;
}
