def gcd(x, y):

    if y > x:

        x, y = y, x

    while y:

        x, y = y, x % y

    return x



N=int(eval(input()))

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



l=[0]*N

l[0]=a[0]

for i in range(1,N):

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



r=[0]*N

r[N-1]=a[N-1]

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

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



ans=max(r[1],l[N-2])

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

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

    ans=max(tmp,ans)



print(ans)
def gcd(x, y):

    if y > x:

        x, y = y, x

    while y:

        x, y = y, x % y

    return x



N=int(eval(input()))

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



l=[0]*N

l[0]=a[0]

for i in range(1,N):

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



r=[0]*N

r[N-1]=a[N-1]

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

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



ans=max(r[1],l[N-2])

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

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

    if tmp>ans: ans=tmp



print(ans)
def gcd(x, y):
    if y > x:
        x, y = y, x
    while y:
        x, y = y, x % y
    return x


N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * N
l[0] = a[0]
for i in range(1, N):
    l[i] = gcd(l[i - 1], a[i])
r = [0] * N
r[N - 1] = a[N - 1]
for i in range(N - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i])
ans = max(r[1], l[N - 2])
for i in range(1, N - 1):
    tmp = gcd(l[i - 1], r[i + 1])
    ans = max(tmp, ans)
print(ans)

def gcd(x, y):
    if y > x:
        x, y = y, x
    while y:
        x, y = y, x % y
    return x


N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * N
l[0] = a[0]
for i in range(1, N):
    l[i] = gcd(l[i - 1], a[i])
r = [0] * N
r[N - 1] = a[N - 1]
for i in range(N - 2, -1, -1):
    r[i] = gcd(r[i + 1], a[i])
ans = max(r[1], l[N - 2])
for i in range(1, N - 1):
    tmp = gcd(l[i - 1], r[i + 1])
    if tmp > ans:
        ans = tmp
print(ans)

-    ans = max(tmp, ans) +    if tmp > ans: +        ans = tmp