#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, cnt = 0;
  cin >> n;
  while (n > 0) {
    if ((n % 10 == 7) || (n % 10 == 4)) {
      cnt++;
    }
    n /= 10;
  }
  int flag = 0;
  while (cnt > 0) {
    if ((cnt % 10 != 7) && (cnt % 10 != 4)) {
      flag = 0;
      break;
    } else {
      flag = 1;
    }
    cnt /= 10;
  }
  if (flag == 1) {
    cout << "YES" << endl;
  } else if (flag == 0) {
    cout << "NO" << endl;
  }
}
