#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <cstdio>
using namespace std;
int main()
{
long long n; cin >>n;
short c=0;
while(n) {
if( n%10==4 || n%10==7) c++;
n /= 10;
}
puts( (c==4||c==7)?"YES":"NO" );
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewoJbG9uZyBsb25nIG47IGNpbiA+Pm47CglzaG9ydCBjPTA7Cgl3aGlsZShuKSB7CgkJaWYoIG4lMTA9PTQgfHwgbiUxMD09NykgYysrOwoJCW4gLz0gMTA7Cgl9CgkKCXB1dHMoIChjPT00fHxjPT03KT8iWUVTIjoiTk8iICk7Cgp9