#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1E9 + 5;
const double EPS = 1E-9;
const long long MOD = (long long)1E9 + 7;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
string s, tmp;
long long cnt;
int main() {
  cin >> s;
  for (int i = 0; i < (s.length()); i++)
    if (s[i] == '4' || s[i] == '7') cnt++;
  stringstream ss;
  ss << cnt;
  ss >> tmp;
  for (int i = 0; i < (tmp.length()); i++)
    if (tmp[i] != '4' && tmp[i] != '7') {
      cout << "NO";
      return 0;
    }
  cout << "YES";
  return 0;
}
