from fractions import gcd

N = int(eval(input()))

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

l = [0] * N

r = [0] * N

m = [0] * N



for i in range(N):

  if i == 0:

    l[i] = 0

  else:

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



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

  if j == N - 1:

    r[j] = 0

  else:

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

    

for k in range(N):

#  print(r[k], l[k])

  m[k] = gcd(r[k], l[k])

  

print((max(m)))
from math import gcd



n = int(eval(input()))

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



L = [0] * n

L[0] = A[0]

for i, a in enumerate(A):

  L[i] = gcd(L[max(0, i - 1)], a)

  

R = [0] * n 

R[0] = A[-1]

for i, a in enumerate(A[::-1]):

  R[i] = gcd(R[max(0, i - 1)], a)



ans = 0

for i in range(n):

  if i == 0:

    ans = max(ans, R[n - 2])

  elif i == n - 1:

    ans = max(ans, L[n - 2])

  else:

    ans = max(ans, gcd(L[i - 1], R[n - i - 2]))

    

print(ans)
from fractions import gcd

N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * N
r = [0] * N
m = [0] * N
for i in range(N):
    if i == 0:
        l[i] = 0
    else:
        l[i] = gcd(l[i - 1], a[i - 1])
for j in reversed(list(range(N))):
    if j == N - 1:
        r[j] = 0
    else:
        r[j] = gcd(r[j + 1], a[j + 1])
for k in range(N):
    #  print(r[k], l[k])
    m[k] = gcd(r[k], l[k])
print((max(m)))

from math import gcd

n = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * n
L[0] = A[0]
for i, a in enumerate(A):
    L[i] = gcd(L[max(0, i - 1)], a)
R = [0] * n
R[0] = A[-1]
for i, a in enumerate(A[::-1]):
    R[i] = gcd(R[max(0, i - 1)], a)
ans = 0
for i in range(n):
    if i == 0:
        ans = max(ans, R[n - 2])
    elif i == n - 1:
        ans = max(ans, L[n - 2])
    else:
        ans = max(ans, gcd(L[i - 1], R[n - i - 2]))
print(ans)

-from fractions import gcd +from math import gcd -N = int(eval(input())) -a = list(map(int, input().split())) -l = [0] * N -r = [0] * N -m = [0] * N -for i in range(N): +n = int(eval(input())) +A = list(map(int, input().split())) +L = [0] * n +L[0] = A[0] +for i, a in enumerate(A): +    L[i] = gcd(L[max(0, i - 1)], a) +R = [0] * n +R[0] = A[-1] +for i, a in enumerate(A[::-1]): +    R[i] = gcd(R[max(0, i - 1)], a) +ans = 0 +for i in range(n): -        l[i] = 0 +        ans = max(ans, R[n - 2]) +    elif i == n - 1: +        ans = max(ans, L[n - 2]) -        l[i] = gcd(l[i - 1], a[i - 1]) -for j in reversed(list(range(N))): -    if j == N - 1: -        r[j] = 0 -    else: -        r[j] = gcd(r[j + 1], a[j + 1]) -for k in range(N): -    #  print(r[k], l[k]) -    m[k] = gcd(r[k], l[k]) -print((max(m))) +        ans = max(ans, gcd(L[i - 1], R[n - i - 2])) +print(ans)