N = int(eval(input()))

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



l = []

r = []

import fractions as fr

l.append(0)

l.append(A[0])

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

    l.append(fr.gcd(l[i],A[i]))

r.append(0)

r.append(A[-1])

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

    r.append(fr.gcd(r[i],A[-i-1]))



ans = 0

for i in range(N):

    ans = max(ans, fr.gcd(l[i],r[-i-1]))

print(ans)

import fractions as fr



N = int(eval(input()))

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



l = [0,A[0]]

r = [0,A[-1]]

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

    l.append(fr.gcd(l[i],A[i]))

    r.append(fr.gcd(r[i],A[-i-1]))



ans = 0

for i in range(N):

    ans = max(ans, fr.gcd(l[i],r[-i-1]))

print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
l = []
r = []
import fractions as fr

l.append(0)
l.append(A[0])
for i in range(1, N - 1):
    l.append(fr.gcd(l[i], A[i]))
r.append(0)
r.append(A[-1])
for i in range(1, N - 1):
    r.append(fr.gcd(r[i], A[-i - 1]))
ans = 0
for i in range(N):
    ans = max(ans, fr.gcd(l[i], r[-i - 1]))
print(ans)

import fractions as fr

N = int(eval(input()))
A = list(map(int, input().split()))
l = [0, A[0]]
r = [0, A[-1]]
for i in range(1, N - 1):
    l.append(fr.gcd(l[i], A[i]))
    r.append(fr.gcd(r[i], A[-i - 1]))
ans = 0
for i in range(N):
    ans = max(ans, fr.gcd(l[i], r[-i - 1]))
print(ans)

+import fractions as fr + -l = [] -r = [] -import fractions as fr - -l.append(0) -l.append(A[0]) +l = [0, A[0]] +r = [0, A[-1]] -r.append(0) -r.append(A[-1]) -for i in range(1, N - 1):