#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*/ freopen(char *, char *, int /*<<< orphan*/);
int lcm(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  int n, i, j, max;
  freopen("prevdiv.in", "r", stdin);
  freopen("prevdiv.out", "w", stdout);
  scanf("%d", &n);
  i = 1;
  while (n--) {
    scanf("%d", &j);
    i = lcm(i, j);
    if (i == j) {
      max = j;
    }
    if (i == 2000000000) {
      break;
    }
  }
  printf("%d\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edx
lea    0xe92(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe8d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f9 <main+0xb9>
lea    0xe62(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <lcm@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11e2 <main+0xa2>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x77359400,-0xc(%rbp)
jne    11f4 <main+0xb4>
jmp    11f9 <main+0xb9>
jmp    119e <main+0x5e>
mov    -0x14(%rbp),%esi
lea    0xe1b(%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   %rbx
push   %rax
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
lea    0xea9(%rip),%rdi
lea    0xead(%rip),%rsi
call   1050 <freopen@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edx
lea    0xe9a(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <freopen@plt>
lea    0xe95(%rip),%r14
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
mov    $0x1,%ebx
mov    %rsp,%r15
nopl   0x0(%rax,%rax,1)
subl   $0x1,0x4(%rsp)
jb     11ce <main+0x8e>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    (%rsp),%esi
mov    %ebx,%edi
call   1040 <lcm@plt>
mov    %eax,%ebx
mov    (%rsp),%eax
cmp    %eax,%ebx
cmove  %eax,%ebp
cmp    $0x77359400,%ebx
jne    11a0 <main+0x60>
lea    0xe49(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"prevdiv.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [12 x i8] c"prevdiv.out\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @stdin
%7 = call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @freopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %11
11: ; preds = %29, %0
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %30
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @lcm(i32 %17, i32 %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = load i32, i32* %4
store i32 %24, i32* %5
br label %25
25: ; preds = %23, %15
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 2000000000
br i1 %27, label %28, label %29
28: ; preds = %25
br label %30
29: ; preds = %25
br label %11
30: ; preds = %28, %11
%31 = load i32, i32* %5
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"prevdiv.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [12 x i8] c"prevdiv.out\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @stdin
%6 = tail call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @stdout
%8 = tail call i32 @freopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
br label %10
10: ; preds = %16, %0
%11 = phi i32 [ 1, %0 ], [ %19, %16 ]
%12 = phi i32 [ undef, %0 ], [ %22, %16 ]
%13 = load i32, i32* %1
%14 = add nsw i32 %13, -1
store i32 %14, i32* %1
%15 = icmp eq i32 %13, 0
br i1 %15, label %24, label %16
16: ; preds = %10
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = call i32 @lcm(i32 %11, i32 %18)
%20 = load i32, i32* %2
%21 = icmp eq i32 %19, %20
%22 = select i1 %21, i32 %20, i32 %12
%23 = icmp eq i32 %19, 2000000000
br i1 %23, label %24, label %10
24: ; preds = %16, %10
%25 = phi i32 [ %22, %16 ], [ %12, %10 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %25)
ret i32 0
}