#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int n;
  scanf("%I64d", &n);
  int count = 0, t;
  while (n) {
    t = n % 10;
    if (t == 4 || t == 7)
      count++;
    n /= 10;
  }
  if (count == 4 || count == 7)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1198 <main+0x78>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
je     1178 <main+0x58>
cmpl   $0x7,-0x18(%rbp)
jne    1181 <main+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
jmp    1146 <main+0x26>
cmpl   $0x4,-0x14(%rbp)
je     11ac <main+0x8c>
cmpl   $0x7,-0x14(%rbp)
jne    11bd <main+0x9d>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xa9>
lea    0xe47(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rcx
test   %rcx,%rcx
je     11ac <main+0x8c>
xor    %esi,%esi
movabs $0x6666666666666667,%r8
66 66 66
jmp    1160 <main+0x40>
nopw   0x0(%rax,%rax,1)
add    $0x1,%esi
add    $0x9,%rcx
cmp    $0x12,%rcx
mov    %rdx,%rcx
jbe    118a <main+0x6a>
mov    %rcx,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%edi
mov    %ecx,%eax
sub    %edi,%eax
cmp    $0x7,%eax
je     1150 <main+0x30>
cmp    $0x4,%eax
je     1150 <main+0x30>
jmp    1153 <main+0x33>
cmp    $0x4,%esi
lea    0xe75(%rip),%rax
lea    0xe6b(%rip),%rdi
cmove  %rax,%rdi
mov    %rdx,(%rsp)
cmp    $0x7,%esi
cmove  %rax,%rdi
jmp    11b3 <main+0x93>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%I64d\00"
@.str.1 = [5 x i8] c"YES\0A\00"
@.str.2 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %2)
store i32 0, i32* %3
br label %6
6: ; preds = %21, %0
%7 = load i64, i64* %2
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i64, i64* %2
%11 = srem i64 %10, 10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 4
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 7
br i1 %17, label %18, label %21
18: ; preds = %15, %9
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %21
21: ; preds = %18, %15
%22 = load i64, i64* %2
%23 = sdiv i64 %22, 10
store i64 %23, i64* %2
br label %6
24: ; preds = %6
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 4
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, 7
br i1 %29, label %30, label %32
30: ; preds = %27, %24
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%I64d\00"
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = icmp eq i64 %4, 0
br i1 %5, label %23, label %6
6: ; preds = %0, %14
%7 = phi i32 [ %15, %14 ], [ 0, %0 ]
%8 = phi i64 [ %10, %14 ], [ %4, %0 ]
%9 = srem i64 %8, 10
%10 = sdiv i64 %8, 10
%11 = trunc i64 %9 to i32
switch i32 %11, label %14 [
i32 7, label %12
i32 4, label %12
]
12: ; preds = %6, %6
%13 = add nsw i32 %7, 1
br label %14
14: ; preds = %6, %12
%15 = phi i32 [ %13, %12 ], [ %7, %6 ]
%16 = add i64 %8, 9
%17 = icmp ult i64 %16, 19
br i1 %17, label %18, label %6
18: ; preds = %14
store i64 %10, i64* %1
%19 = icmp eq i32 %15, 7
%20 = icmp eq i32 %15, 4
%21 = or i1 %19, %20
%22 = select i1 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
br label %23
23: ; preds = %0, %18
%24 = phi i8* [ %22, %18 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %0 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
ret i32 0
}