from fractions import gcd

N = int(eval(input()))

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



L = []

R = []

tl = A[0]

tr = A[-1]

for i in range(N):

  tl = gcd(tl, A[i])

  L.append(tl)

  tr = gcd(tr, A[N-1-i])

  R.append(tr)

mx = 1

R.reverse()

for i in range(N):

  tl = L[i-1] if i else R[i+1]

  tr = R[i+1] if i+1 < N else L[i-1]

  mx = max(mx, gcd(tl, tr))

print(mx)  
from fractions import gcd

n = int(eval(input()))

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

b,c = [], []

bb,cc = a[0], a[-1]



for i in range(n):

  bb, cc = gcd(bb, a[i]), gcd(cc, a[-i-1])

  b.append(bb)

  c.append(cc)



ans = 1

c = c[::-1]

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

  ans = max(ans, gcd(b[i-1], c[i+1]))

print((max([ans, b[-2], c[1]])))



from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
L = []
R = []
tl = A[0]
tr = A[-1]
for i in range(N):
    tl = gcd(tl, A[i])
    L.append(tl)
    tr = gcd(tr, A[N - 1 - i])
    R.append(tr)
mx = 1
R.reverse()
for i in range(N):
    tl = L[i - 1] if i else R[i + 1]
    tr = R[i + 1] if i + 1 < N else L[i - 1]
    mx = max(mx, gcd(tl, tr))
print(mx)

from fractions import gcd

n = int(eval(input()))
a = list(map(int, input().split()))
b, c = [], []
bb, cc = a[0], a[-1]
for i in range(n):
    bb, cc = gcd(bb, a[i]), gcd(cc, a[-i - 1])
    b.append(bb)
    c.append(cc)
ans = 1
c = c[::-1]
for i in range(1, n - 1):
    ans = max(ans, gcd(b[i - 1], c[i + 1]))
print((max([ans, b[-2], c[1]])))

-N = int(eval(input())) -A = list(map(int, input().split())) -L = [] -R = [] -tl = A[0] -tr = A[-1] -for i in range(N): -    tl = gcd(tl, A[i]) -    L.append(tl) -    tr = gcd(tr, A[N - 1 - i]) -    R.append(tr) -mx = 1 -R.reverse() -for i in range(N): -    tl = L[i - 1] if i else R[i + 1] -    tr = R[i + 1] if i + 1 < N else L[i - 1] -    mx = max(mx, gcd(tl, tr)) -print(mx) +n = int(eval(input())) +a = list(map(int, input().split())) +b, c = [], [] +bb, cc = a[0], a[-1] +for i in range(n): +    bb, cc = gcd(bb, a[i]), gcd(cc, a[-i - 1]) +    b.append(bb) +    c.append(cc) +ans = 1 +c = c[::-1] +for i in range(1, n - 1): +    ans = max(ans, gcd(b[i - 1], c[i + 1])) +print((max([ans, b[-2], c[1]])))