#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 *, int *, char *);
int main() {
  char num[55];
  int nu, nu1 = 0, nu2 = 0, count, *ptrf = &nu1;
  scanf("%d%s", &nu, num);
  for (count = 0; count < nu; count++) {
    if (num[count] == '7' || num[count] == '4')
      *ptrf += num[count] - 48;
    else
      break;
    if (count == (nu / 2 - 1))
      ptrf = &nu2;
  }
  if (count == nu && nu2 == nu1)
    printf("YES");
  else
    printf("NO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
lea    -0x48(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x40(%rbp),%rdx
lea    0xeb0(%rip),%rdi
lea    -0x44(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11ea <main+0xca>
movslq -0x50(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x37,%eax
je     1190 <main+0x70>
movslq -0x50(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x34,%eax
jne    11a9 <main+0x89>
movslq -0x50(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%ecx
sub    $0x30,%ecx
mov    -0x58(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
jmp    11ae <main+0x8e>
jmp    11ea <main+0xca>
mov    -0x50(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11d7 <main+0xb7>
lea    -0x4c(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    11dc <main+0xbc>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1160 <main+0x40>
mov    -0x50(%rbp),%eax
cmp    -0x44(%rbp),%eax
jne    1213 <main+0xf3>
mov    -0x4c(%rbp),%eax
cmp    -0x48(%rbp),%eax
jne    1213 <main+0xf3>
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
jmp    121f <main+0xff>
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%r9d
test   %r9d,%r9d
jle    11a0 <main+0x80>
mov    %r9d,%edx
shr    %edx
add    $0xffffffff,%edx
lea    0x8(%rsp),%rsi
xor    %ecx,%ecx
lea    0x4(%rsp),%r8
jmp    1189 <main+0x69>
nopw   0x0(%rax,%rax,1)
mov    (%rsi),%eax
add    %edi,%eax
add    $0xffffffd0,%eax
mov    %eax,(%rsi)
cmp    %rcx,%rdx
cmove  %r8,%rsi
add    $0x1,%rcx
cmp    %rcx,%r9
je     11a7 <main+0x87>
movzbl 0x10(%rsp,%rcx,1),%edi
cmp    $0x37,%edi
je     1170 <main+0x50>
cmp    $0x34,%dil
je     1170 <main+0x50>
cmp    %r9d,%ecx
je     11a7 <main+0x87>
jmp    11ba <main+0x9a>
xor    %ecx,%ecx
cmp    %r9d,%ecx
jne    11ba <main+0x9a>
mov    0x4(%rsp),%eax
cmp    0x8(%rsp),%eax
jne    11ba <main+0x9a>
lea    0xe4d(%rip),%rdi
jmp    11c1 <main+0xa1>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%s\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [55 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32* %4, i32** %7
%8 = getelementptr inbounds [55 x i8], [55 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i8* %8)
store i32 0, i32* %6
br label %10
10: ; preds = %47, %0
%11 = load i32, i32* %6
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %50
14: ; preds = %10
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [55 x i8], [55 x i8]* %2, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 55
br i1 %20, label %28, label %21
21: ; preds = %14
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [55 x i8], [55 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 52
br i1 %27, label %28, label %38
28: ; preds = %21, %14
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [55 x i8], [55 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = load i32*, i32** %7
%36 = load i32, i32* %35
%37 = add nsw i32 %36, %34
store i32 %37, i32* %35
br label %39
38: ; preds = %21
br label %50
39: ; preds = %28
%40 = load i32, i32* %6
%41 = load i32, i32* %3
%42 = sdiv i32 %41, 2
%43 = sub nsw i32 %42, 1
%44 = icmp eq i32 %40, %43
br i1 %44, label %45, label %46
45: ; preds = %39
store i32* %5, i32** %7
br label %46
46: ; preds = %45, %39
br label %47
47: ; preds = %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %10
50: ; preds = %38, %10
%51 = load i32, i32* %6
%52 = load i32, i32* %3
%53 = icmp eq i32 %51, %52
br i1 %53, label %54, label %60
54: ; preds = %50
%55 = load i32, i32* %5
%56 = load i32, i32* %4
%57 = icmp eq i32 %55, %56
br i1 %57, label %58, label %60
58: ; preds = %54
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %62
60: ; preds = %54, %50
%61 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %58
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%s\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca [55 x i8]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = getelementptr inbounds [55 x i8], [55 x i8]* %1, i64 0, i64 0
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i8* %5)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %33
12: ; preds = %0
%13 = lshr i32 %10, 1
%14 = add nsw i32 %13, -1
%15 = zext i32 %14 to i64
%16 = zext i32 %10 to i64
br label %17
17: ; preds = %12, %22
%18 = phi i64 [ 0, %12 ], [ %29, %22 ]
%19 = phi i32* [ %3, %12 ], [ %28, %22 ]
%20 = getelementptr inbounds [55 x i8], [55 x i8]* %1, i64 0, i64 %18
%21 = load i8, i8* %20
switch i8 %21, label %31 [
i8 55, label %22
i8 52, label %22
]
22: ; preds = %17, %17
%23 = zext i8 %21 to i32
%24 = add nsw i32 %23, -48
%25 = load i32, i32* %19
%26 = add nsw i32 %24, %25
store i32 %26, i32* %19
%27 = icmp eq i64 %18, %15
%28 = select i1 %27, i32* %4, i32* %19
%29 = add nuw nsw i64 %18, 1
%30 = icmp eq i64 %29, %16
br i1 %30, label %36, label %17
31: ; preds = %17
%32 = trunc i64 %18 to i32
br label %33
33: ; preds = %31, %0
%34 = phi i32 [ 0, %0 ], [ %32, %31 ]
%35 = icmp eq i32 %34, %10
br i1 %35, label %36, label %40
36: ; preds = %22, %33
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = icmp eq i32 %37, %38
br i1 %39, label %41, label %40
40: ; preds = %36, %33
br label %41
41: ; preds = %36, %40
%42 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %40 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %36 ]
%43 = call i32 @printf(i8* dereferenceable(1) %42)
ret i32 0
}