def gcd(m, n):

    r = m % n

    return gcd(n, r) if r else n



N = int(eval(input()))

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



L = [0]*N

L[0] = A[0]

v = A[0]

for i in range(N-1):

    L[i+1] = v = gcd(v, A[i+1])

R = [0]*N

R[-1] = A[-1]

v = A[-1]

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

    R[i] = v = gcd(v, A[i])

ans = max(L[-1], L[-2], R[1])

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

    ans = max(ans, gcd(L[i-1], R[i+1]))

print(ans)
from fractions import gcd

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



L = [0]*N

L[0] = v = A[0]

for i in range(N-1):

    L[i+1] = v = gcd(v, A[i+1])

R = [0]*N

R[-1] = v = A[-1]

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

    R[i] = v = gcd(v, A[i])

ans = max(L[-1], L[-2], R[1])

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

    ans = max(ans, gcd(L[i-1], R[i+1]))

print(ans)
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n


N = int(eval(input()))
(*A,) = list(map(int, input().split()))
L = [0] * N
L[0] = A[0]
v = A[0]
for i in range(N - 1):
    L[i + 1] = v = gcd(v, A[i + 1])
R = [0] * N
R[-1] = A[-1]
v = A[-1]
for i in range(N - 1, -1, -1):
    R[i] = v = gcd(v, A[i])
ans = max(L[-1], L[-2], R[1])
for i in range(1, N - 1):
    ans = max(ans, gcd(L[i - 1], R[i + 1]))
print(ans)

from fractions import gcd

N, *A = list(map(int, open(0).read().split()))
L = [0] * N
L[0] = v = A[0]
for i in range(N - 1):
    L[i + 1] = v = gcd(v, A[i + 1])
R = [0] * N
R[-1] = v = A[-1]
for i in range(N - 1, -1, -1):
    R[i] = v = gcd(v, A[i])
ans = max(L[-1], L[-2], R[1])
for i in range(1, N - 1):
    ans = max(ans, gcd(L[i - 1], R[i + 1]))
print(ans)

-def gcd(m, n): -    r = m % n -    return gcd(n, r) if r else n +from fractions import gcd - -N = int(eval(input())) -(*A,) = list(map(int, input().split())) +N, *A = list(map(int, open(0).read().split())) -L[0] = A[0] -v = A[0] +L[0] = v = A[0] -R[-1] = A[-1] -v = A[-1] +R[-1] = v = A[-1]