# -*- coding: utf-8 -*-

n = int(eval(input()))

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



def gcd(a,b):

    while b>0:

        a,b = b,a%b

    return a



ll = [0]*n

ll[0] = al[0]

for i in range(1,n):

    ll[i] = gcd(al[i], ll[i-1])



rl = [0]*n

rl[n-1] = al[n-1]

for i in range(n-2,-1,-1):

    rl[i] = gcd(al[i],rl[i+1])



res = -1



for i in range(n):

    if i==0:

        res = max(res, rl[1])

    elif i==n-1:

        res = max(res, ll[n-2])

    else:

        res = max(res, gcd(ll[i-1],rl[i+1]))



print(res)

n = int(eval(input()))

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



def gcd(a,b):

    while b>0:

        a,b = b,a%b

    return a





accl = [0]*(n+1)

accr = [0]*(n+1)



accl[0] = al[0]

for i in range(n):

    accl[i+1] = gcd(accl[i],al[i])



accr[n] = al[n-1]

for i in range(n,0,-1):

    accr[i-1] = gcd(accr[i],al[i-1])



res = 0

for i in range(n):

    if i==0:

        res = max(res, accr[1])

    elif i==n-1:

        res = max(res, accl[n-1])

    else:

        res = max(res, gcd(accl[i], accr[i+1]))

print(res)
# -*- coding: utf-8 -*-
n = int(eval(input()))
al = list(map(int, input().split()))


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


ll = [0] * n
ll[0] = al[0]
for i in range(1, n):
    ll[i] = gcd(al[i], ll[i - 1])
rl = [0] * n
rl[n - 1] = al[n - 1]
for i in range(n - 2, -1, -1):
    rl[i] = gcd(al[i], rl[i + 1])
res = -1
for i in range(n):
    if i == 0:
        res = max(res, rl[1])
    elif i == n - 1:
        res = max(res, ll[n - 2])
    else:
        res = max(res, gcd(ll[i - 1], rl[i + 1]))
print(res)

n = int(eval(input()))
al = list(map(int, input().split()))


def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a


accl = [0] * (n + 1)
accr = [0] * (n + 1)
accl[0] = al[0]
for i in range(n):
    accl[i + 1] = gcd(accl[i], al[i])
accr[n] = al[n - 1]
for i in range(n, 0, -1):
    accr[i - 1] = gcd(accr[i], al[i - 1])
res = 0
for i in range(n):
    if i == 0:
        res = max(res, accr[1])
    elif i == n - 1:
        res = max(res, accl[n - 1])
    else:
        res = max(res, gcd(accl[i], accr[i + 1]))
print(res)

-# -*- coding: utf-8 -*- -ll = [0] * n -ll[0] = al[0] -for i in range(1, n): -    ll[i] = gcd(al[i], ll[i - 1]) -rl = [0] * n -rl[n - 1] = al[n - 1] -for i in range(n - 2, -1, -1): -    rl[i] = gcd(al[i], rl[i + 1]) -res = -1 +accl = [0] * (n + 1) +accr = [0] * (n + 1) +accl[0] = al[0] +for i in range(n): +    accl[i + 1] = gcd(accl[i], al[i]) +accr[n] = al[n - 1] +for i in range(n, 0, -1): +    accr[i - 1] = gcd(accr[i], al[i - 1]) +res = 0 -        res = max(res, rl[1]) +        res = max(res, accr[1]) -        res = max(res, ll[n - 2]) +        res = max(res, accl[n - 1]) -        res = max(res, gcd(ll[i - 1], rl[i + 1])) +        res = max(res, gcd(accl[i], accr[i + 1]))