#include <bits/stdc++.h>
using namespace std;
const int MOD = 1E9 + 7;
const int N = 1E5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int lucky = 0;
  for (auto c : s) {
    if (c == '4' || c == '7') lucky++;
  }
  if (lucky == 0)
    cout << "NO\n";
  else {
    puts((lucky == 4 || lucky == 7) ? "YES" : "NO");
  }
}
