#include <bits/stdc++.h>
using namespace std;
bool check(int n) {
  if (n == 0) {
    return false;
  }
  while (n) {
    int temp = n % 10;
    if (temp != 4 && temp != 7) {
      return false;
    }
    n = n / 10;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string second;
  cin >> second;
  int a = 0;
  for (int i = 0; i < second.length(); i++) {
    if (second[i] == '4' || second[i] == '7') {
      a++;
    }
  }
  if (check(a) == true) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
