#include <bits/stdc++.h>
using namespace std;
int dp[100100][102];
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  int ans = 0;
  while (n) {
    ans += (n % 10 == 7 || n % 10 == 4);
    n /= 10;
  }
  cout << (ans == 4 || ans == 7 ? "YES" : "NO");
  return 0;
}
