#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 check(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, j;
  int a[n];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  if (check(a, n) == 1)
    printf("YES");
  else if (check(a, n) == 0)
    printf("NO");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b2 <main+0x82>
mov    -0x28(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe61(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x4d>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <check@plt>
cmp    $0x1,%eax
jne    11d8 <main+0xa8>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xce>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <check@plt>
cmp    $0x0,%eax
jne    11f9 <main+0xc9>
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
jmp    11fe <main+0xce>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsp,%r15
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    117d <main+0x4d>
mov    %rsp,%r12
xor    %ebx,%ebx
lea    0xea0(%rip),%r14
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rsi
add    $0x4,%r12
cmp    %rsi,%rbx
jl     1160 <main+0x30>
mov    %rsp,%rdi
call   1050 <check@plt>
cmp    $0x1,%eax
jne    1193 <main+0x63>
lea    0xe72(%rip),%rdi
jmp    11aa <main+0x7a>
mov    0x4(%rsp),%esi
mov    %rsp,%rdi
call   1050 <check@plt>
test   %eax,%eax
jne    11af <main+0x7f>
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
mov    %r15,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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 i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 0, i32* %1
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca i32, i64 %8
store i64 %8, i64* %6
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %12
12: ; preds = %21, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %10, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %16
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %12
24: ; preds = %12
%25 = load i32, i32* %2
%26 = call i32 @check(i32* %10, i32 %25)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %37
30: ; preds = %24
%31 = load i32, i32* %2
%32 = call i32 @check(i32* %10, i32 %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %30
br label %37
37: ; preds = %36, %28
store i32 0, i32* %1
%38 = load i8*, i8** %5
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"YES\00"
@.str.2 = [3 x i8] c"NO\00"
define i32 @main() {
%1 = alloca [0 x i32]
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i8* @llvm.stacksave()
%5 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %0, %9
%10 = phi i64 [ %13, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = add nuw nsw i64 %10, 1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %9, label %17
17: ; preds = %9, %0
%18 = phi i32 [ %7, %0 ], [ %14, %9 ]
%19 = call i32 @check(i32* %5, i32 %18)
%20 = icmp eq i32 %19, 1
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i32, i32* %2
%23 = call i32 @check(i32* %5, i32 %22)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21, %17
%26 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %17 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %21 ]
%27 = call i32 @printf(i8* dereferenceable(1) %26)
br label %28
28: ; preds = %25, %21
ret i32 0
}