#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9 + 7);
const long long INF = (long long)(10e18 + 7);
const long double eps = (long double)(1e-9);
const int MOD = (int)(1e9 + 7);
void solve();
long long power(long long x, long long y, long long mod = MOD) {
  if (y == 0) {
    return 1;
  }
  if (y & 1) {
    return power(x, y - 1, mod) * x % mod;
  } else {
    long long tmp = power(x, y / 2, mod);
    return tmp * tmp % mod;
  }
}
long long add(long long x, long long y, long long mod = MOD) {
  x += y;
  if (x >= mod) return x - mod;
  return x;
}
long long sub(long long x, long long y, long long mod = MOD) {
  x -= y;
  if (x < 0) return x + mod;
  return x;
}
long long mult(long long x, long long y, long long mod = MOD) {
  return (x * y) % mod;
}
signed main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  solve();
  return 0;
}
const int maxn = (int)(1 * 1e5 + 10);
const int maxm = (int)(1 * 1e6 + 10);
int arr[30];
void solve() {
  string s;
  cin >> s;
  int cnt = 0;
  for (auto i = (0); i < (s.length()); ++i) {
    if (s[i] == '4' || s[i] == '7') cnt++;
  }
  if (cnt == 4 || cnt == 7)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
