N=int(eval(input()))

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

# 1,7,6,8,1,

# L[i]=A[i]



def gcd(a,b):

  if a<b:

    a,b=b,a

  while a%b>0:

    a,b=b,a%b

  return b



L=[1]*len(A)

L[0]=A[0]

for i in range(len(A)-1):

  L[i+1]=gcd(L[i],A[i+1])

  

R=[1]*len(A)

R[-1]=A[-1]

for i in range(len(A)-1,0,-1):

  R[i-1]=gcd(R[i],A[i-1])



ans=1

for i in range(len(A)):

  if i==0:

    if ans<R[i+1]:

      ans=R[i+1]

  elif i==len(A)-1:

    if ans<L[i-1]:

      ans=L[i-1]

  else:

    p=gcd(L[i-1],R[i+1])

    if ans<p:

      ans=p

print(ans)

import sys

readline = sys.stdin.readline



N = int(readline())

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



if N == 2:

  print((max(A)))

  exit(0)



def gcd(a,b):

  if a < b:

    a,b = b,a

  while a%b > 0:

    a,b = b,a%b

  return b



left = [None] * N

left[0] = A[0]

for i in range(1, len(A)):

  left[i] = gcd(left[i - 1],A[i])



right = [None] * N

right[-1] = A[-1]

for i in range(len(A) - 2,-1,-1):

  right[i] = gcd(right[i + 1],A[i])



ans = max(left[-2],right[1])

for i in range(1, len(A) - 1):

  g = gcd(left[i - 1],right[i + 1])

  if ans < g:

    ans = g

print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
# 1,7,6,8,1,
# L[i]=A[i]
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b > 0:
        a, b = b, a % b
    return b


L = [1] * len(A)
L[0] = A[0]
for i in range(len(A) - 1):
    L[i + 1] = gcd(L[i], A[i + 1])
R = [1] * len(A)
R[-1] = A[-1]
for i in range(len(A) - 1, 0, -1):
    R[i - 1] = gcd(R[i], A[i - 1])
ans = 1
for i in range(len(A)):
    if i == 0:
        if ans < R[i + 1]:
            ans = R[i + 1]
    elif i == len(A) - 1:
        if ans < L[i - 1]:
            ans = L[i - 1]
    else:
        p = gcd(L[i - 1], R[i + 1])
        if ans < p:
            ans = p
print(ans)

import sys

readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))
if N == 2:
    print((max(A)))
    exit(0)


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


left = [None] * N
left[0] = A[0]
for i in range(1, len(A)):
    left[i] = gcd(left[i - 1], A[i])
right = [None] * N
right[-1] = A[-1]
for i in range(len(A) - 2, -1, -1):
    right[i] = gcd(right[i + 1], A[i])
ans = max(left[-2], right[1])
for i in range(1, len(A) - 1):
    g = gcd(left[i - 1], right[i + 1])
    if ans < g:
        ans = g
print(ans)

-N = int(eval(input())) -A = list(map(int, input().split())) -# 1,7,6,8,1, -# L[i]=A[i] +import sys + +readline = sys.stdin.readline +N = int(readline()) +A = list(map(int, readline().split())) +if N == 2: +    print((max(A))) +    exit(0) + + -L = [1] * len(A) -L[0] = A[0] -for i in range(len(A) - 1): -    L[i + 1] = gcd(L[i], A[i + 1]) -R = [1] * len(A) -R[-1] = A[-1] -for i in range(len(A) - 1, 0, -1): -    R[i - 1] = gcd(R[i], A[i - 1]) -ans = 1 -for i in range(len(A)): -    if i == 0: -        if ans < R[i + 1]: -            ans = R[i + 1] -    elif i == len(A) - 1: -        if ans < L[i - 1]: -            ans = L[i - 1] -    else: -        p = gcd(L[i - 1], R[i + 1]) -        if ans < p: -            ans = p +left = [None] * N +left[0] = A[0] +for i in range(1, len(A)): +    left[i] = gcd(left[i - 1], A[i]) +right = [None] * N +right[-1] = A[-1] +for i in range(len(A) - 2, -1, -1): +    right[i] = gcd(right[i + 1], A[i]) +ans = max(left[-2], right[1]) +for i in range(1, len(A) - 1): +    g = gcd(left[i - 1], right[i + 1]) +    if ans < g: +        ans = g