#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 *, unsigned long long);
scalar_t__ scanf(char *, unsigned long long *);
int main() {
  unsigned long long int N, i, j, temp, max, a;
  while (scanf("%llu", &N)) {
    if (N == 0)
      break;
    else {
      scanf("%llu", &max);
      for (i = 0; i < N - 1; i++) {
        scanf("%llu", &a);
        if (a > max)
          max = a;
      }
      printf("%llu\n", max);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     11d7 <main+0xb7>
cmpq   $0x0,-0x10(%rbp)
jne    1159 <main+0x39>
jmp    11d7 <main+0xb7>
lea    0xea0(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <scanf@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    11c2 <main+0xa2>
lea    0xe73(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jbe    11ac <main+0x8c>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    11b1 <main+0x91>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1171 <main+0x51>
mov    -0x30(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11f5 <main+0xd5>
cmpq   $0x0,(%rsp)
je     11f5 <main+0xd5>
lea    0xea8(%rip),%rbx
lea    0x8(%rsp),%r14
lea    0xea1(%rip),%r15
mov    %rsp,%r12
lea    0x10(%rsp),%r13
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpq   $0x1,(%rsp)
jne    11b0 <main+0x90>
mov    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11f5 <main+0xd5>
cmpq   $0x0,(%rsp)
jne    1170 <main+0x50>
jmp    11f5 <main+0xd5>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
jmp    11d1 <main+0xb1>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbp
mov    (%rsp),%rax
add    $0xffffffffffffffff,%rax
cmp    %rax,%rbp
jae    1187 <main+0x67>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rsi
cmp    %rsi,%rax
jbe    11c0 <main+0xa0>
mov    %rax,0x8(%rsp)
mov    %rax,%rsi
jmp    11c0 <main+0xa0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i64* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%8 = icmp eq i64 %7, 0
%9 = load i64, i64* %1
%10 = icmp eq i64 %9, 0
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %39, label %12
12: ; preds = %0, %31
%13 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%14 = load i64, i64* %1
%15 = icmp eq i64 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i64, i64* %2
br label %31
18: ; preds = %12, %25
%19 = phi i64 [ %27, %25 ], [ 0, %12 ]
%20 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%21 = load i64, i64* %3
%22 = load i64, i64* %2
%23 = icmp ugt i64 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i64 %21, i64* %2
br label %25
25: ; preds = %18, %24
%26 = phi i64 [ %22, %18 ], [ %21, %24 ]
%27 = add nuw i64 %19, 1
%28 = load i64, i64* %1
%29 = add i64 %28, -1
%30 = icmp ult i64 %27, %29
br i1 %30, label %18, label %31
31: ; preds = %25, %16
%32 = phi i64 [ %17, %16 ], [ %26, %25 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %32)
%34 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%35 = icmp eq i64 %34, 0
%36 = load i64, i64* %1
%37 = icmp eq i64 %36, 0
%38 = select i1 %35, i1 true, i1 %37
br i1 %38, label %39, label %12
39: ; preds = %31, %0
ret i32 0
}