#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int size, i, inp, count = 0, max_count = 0;
  scanf("%d", &size);
  for (i = 0; i < size; i++) {
    scanf("%d", &inp);
    if (inp == 0) {
      if (max_count < count)
        max_count = count;
      count = 0;
    } else
      count++;
  }
  if (max_count < count)
    max_count = count;
  printf("%d", max_count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b4 <main+0x94>
lea    0xe99(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    1198 <main+0x78>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118c <main+0x6c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    11a1 <main+0x81>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <main+0x86>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x34>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c6 <main+0xa6>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    118f <main+0x6f>
xor    %r12d,%r12d
lea    0xeb2(%rip),%r14
lea    0xc(%rsp),%r15
xor    %ebx,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rbx),%eax
cmp    %ebx,%r12d
cmovge %r12d,%ebx
test   %ecx,%ecx
cmove  %ecx,%eax
cmove  %ebx,%r12d
add    $0x1,%ebp
mov    %eax,%ebx
cmp    0x8(%rsp),%ebp
jl     1160 <main+0x40>
jmp    1194 <main+0x74>
xor    %eax,%eax
xor    %r12d,%r12d
cmp    %eax,%r12d
cmovl  %eax,%r12d
lea    0xe5e(%rip),%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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