from fractions import gcd

from itertools import accumulate



N = int(eval(input()))

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



b = list(accumulate([0] + a, gcd))

c = list(accumulate([0] + a[::-1], gcd))

l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:]))

print((max(l)))



from math import gcd



N = int(eval(input()))

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



left = [0] * (N + 2)

right = [0] * (N + 2)



for i in range(N):

    left[i + 1] = gcd(left[i], X[i])



for i in reversed(list(range(N))):

    right[i + 1] = gcd(right[i + 2], X[i])



ans = 1

for i in range(N):

    ans = max(ans, gcd(left[i], right[i + 2]))



print(ans)

from fractions import gcd
from itertools import accumulate

N = int(eval(input()))
a = list(map(int, input().split()))
b = list(accumulate([0] + a, gcd))
c = list(accumulate([0] + a[::-1], gcd))
l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:]))
print((max(l)))

from math import gcd

N = int(eval(input()))
X = list(map(int, input().split()))
left = [0] * (N + 2)
right = [0] * (N + 2)
for i in range(N):
    left[i + 1] = gcd(left[i], X[i])
for i in reversed(list(range(N))):
    right[i + 1] = gcd(right[i + 2], X[i])
ans = 1
for i in range(N):
    ans = max(ans, gcd(left[i], right[i + 2]))
print(ans)

-from fractions import gcd -from itertools import accumulate +from math import gcd -a = list(map(int, input().split())) -b = list(accumulate([0] + a, gcd)) -c = list(accumulate([0] + a[::-1], gcd)) -l = list(gcd(s, t) for s, t in zip(b[:-1], c[::-1][1:])) -print((max(l))) +X = list(map(int, input().split())) +left = [0] * (N + 2) +right = [0] * (N + 2) +for i in range(N): +    left[i + 1] = gcd(left[i], X[i]) +for i in reversed(list(range(N))): +    right[i + 1] = gcd(right[i + 2], X[i]) +ans = 1 +for i in range(N): +    ans = max(ans, gcd(left[i], right[i + 2])) +print(ans)