from fractions import gcd

N, *A, = list(map(int, open(0).read().split()))

l = [0]*N

r = [0]*N



# [0,i]のgcd

l[0] = A[0]

for i in range(1, N):

    l[i] = gcd(l[i-1],A[i])



# [i,N-1]のgcd

r[N-1] = A[N-1]

for i in range(N-1)[::-1]:

    r[i] = gcd(r[i+1],A[i])



m = [0]*N

for i in range(1, N-1):

    m[i] = gcd(l[i-1], r[i+1])

m[0] = r[1]

m[N-1] = l[N-2]

print((max(m)))
from itertools import accumulate

from math import gcd

N = int(eval(input()))

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



L = list(accumulate(A, gcd))

R = list(accumulate(A[::-1], gcd))[::-1]



ans = max(gcd(l, r) for l, r in zip([0]+L[:-1], R[1:]+[0]))

print(ans)

from fractions import gcd

(
    N,
    *A,
) = list(map(int, open(0).read().split()))
l = [0] * N
r = [0] * N
# [0,i]のgcd
l[0] = A[0]
for i in range(1, N):
    l[i] = gcd(l[i - 1], A[i])
# [i,N-1]のgcd
r[N - 1] = A[N - 1]
for i in range(N - 1)[::-1]:
    r[i] = gcd(r[i + 1], A[i])
m = [0] * N
for i in range(1, N - 1):
    m[i] = gcd(l[i - 1], r[i + 1])
m[0] = r[1]
m[N - 1] = l[N - 2]
print((max(m)))

from itertools import accumulate
from math import gcd

N = int(eval(input()))
(*A,) = list(map(int, input().split()))
L = list(accumulate(A, gcd))
R = list(accumulate(A[::-1], gcd))[::-1]
ans = max(gcd(l, r) for l, r in zip([0] + L[:-1], R[1:] + [0]))
print(ans)

-from fractions import gcd +from itertools import accumulate +from math import gcd -( -    N, -    *A, -) = list(map(int, open(0).read().split())) -l = [0] * N -r = [0] * N -# [0,i]のgcd -l[0] = A[0] -for i in range(1, N): -    l[i] = gcd(l[i - 1], A[i]) -# [i,N-1]のgcd -r[N - 1] = A[N - 1] -for i in range(N - 1)[::-1]: -    r[i] = gcd(r[i + 1], A[i]) -m = [0] * N -for i in range(1, N - 1): -    m[i] = gcd(l[i - 1], r[i + 1]) -m[0] = r[1] -m[N - 1] = l[N - 2] -print((max(m))) +N = int(eval(input())) +(*A,) = list(map(int, input().split())) +L = list(accumulate(A, gcd)) +R = list(accumulate(A[::-1], gcd))[::-1] +ans = max(gcd(l, r) for l, r in zip([0] + L[:-1], R[1:] + [0])) +print(ans)