import fractions

from functools import reduce

N = int(eval(input()))

A = list(map(int,input().split()))

#累積GCD

left = [0]*(N+1)

right = [0]*(N+1)

for i in range(N):

  left[i+1] = (fractions.gcd(left[i],A[i]))

  right[N-i-1] = (fractions.gcd(right[N-i],A[N-1-i]))



ans = 0

for i in range(N):

  ans = max(ans,fractions.gcd(left[i],right[i + 1]))

print(ans)
import math

N = int(eval(input()))

A = list(map(int,input().split()))

dp_left=[0]*(N+1)

dp_right=[0]*(N+1)

for i in range(N):#左から累積GCD

  dp_left[i+1]=math.gcd(dp_left[i],A[i])

  dp_right[N-i-1]=math.gcd(dp_right[N-i],A[N-1-i])#右から累積GCD



ans = 0

for i in range(N):

  ans = max(ans,math.gcd(dp_left[i],dp_right[i+1]))

print(ans)
import fractions
from functools import reduce

N = int(eval(input()))
A = list(map(int, input().split()))
# 累積GCD
left = [0] * (N + 1)
right = [0] * (N + 1)
for i in range(N):
    left[i + 1] = fractions.gcd(left[i], A[i])
    right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i])
ans = 0
for i in range(N):
    ans = max(ans, fractions.gcd(left[i], right[i + 1]))
print(ans)

import math

N = int(eval(input()))
A = list(map(int, input().split()))
dp_left = [0] * (N + 1)
dp_right = [0] * (N + 1)
for i in range(N):  # 左から累積GCD
    dp_left[i + 1] = math.gcd(dp_left[i], A[i])
    dp_right[N - i - 1] = math.gcd(dp_right[N - i], A[N - 1 - i])  # 右から累積GCD
ans = 0
for i in range(N):
    ans = max(ans, math.gcd(dp_left[i], dp_right[i + 1]))
print(ans)

-import fractions -from functools import reduce +import math -# 累積GCD -left = [0] * (N + 1) -right = [0] * (N + 1) -for i in range(N): -    left[i + 1] = fractions.gcd(left[i], A[i]) -    right[N - i - 1] = fractions.gcd(right[N - i], A[N - 1 - i]) +dp_left = [0] * (N + 1) +dp_right = [0] * (N + 1) +for i in range(N):  # 左から累積GCD +    dp_left[i + 1] = math.gcd(dp_left[i], A[i]) +    dp_right[N - i - 1] = math.gcd(dp_right[N - i], A[N - 1 - i])  # 右から累積GCD -    ans = max(ans, fractions.gcd(left[i], right[i + 1])) +    ans = max(ans, math.gcd(dp_left[i], dp_right[i + 1]))