N = int(eval(input()))

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



def gcd(a,b):

    if b==0:return a

    return gcd(b, a%b)



L = A.copy()

R = A.copy()

for i in range(1, N):

    L[i] = gcd(L[i-1], L[i])



for i in reversed(list(range(0, N-1))):

    R[i] = gcd(R[i+1], R[i])



result = max(R[1],L[-2])



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

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

print(result)

from fractions import gcd

N = int(eval(input()))

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



#def gcd(a,b):

#    if b==0:return a

#    return gcd(b, a%b)



L = A.copy()

R = A.copy()

for i in range(1, N):

    L[i] = gcd(L[i-1], L[i])



for i in reversed(list(range(0, N-1))):

    R[i] = gcd(R[i+1], R[i])



# 端っこをぬかした条件

# A[0  ]ぬかした場合, R[ 1]

# A[N-1]ぬかした場合, L[-2]

result = max(R[1],L[-2])



# 端っこ以外をfor文で

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

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



print(result)

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


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


L = A.copy()
R = A.copy()
for i in range(1, N):
    L[i] = gcd(L[i - 1], L[i])
for i in reversed(list(range(0, N - 1))):
    R[i] = gcd(R[i + 1], R[i])
result = max(R[1], L[-2])
for i in range(1, N - 1):
    result = max(result, gcd(L[i - 1], R[i + 1]))
print(result)

from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
# def gcd(a,b):
#    if b==0:return a
#    return gcd(b, a%b)
L = A.copy()
R = A.copy()
for i in range(1, N):
    L[i] = gcd(L[i - 1], L[i])
for i in reversed(list(range(0, N - 1))):
    R[i] = gcd(R[i + 1], R[i])
# 端っこをぬかした条件
# A[0  ]ぬかした場合, R[ 1]
# A[N-1]ぬかした場合, L[-2]
result = max(R[1], L[-2])
# 端っこ以外をfor文で
for i in range(1, N - 1):
    result = max(result, gcd(L[i - 1], R[i + 1]))
print(result)

+from fractions import gcd + - - -def gcd(a, b): -    if b == 0: -        return a -    return gcd(b, a % b) - - +# def gcd(a,b): +#    if b==0:return a +#    return gcd(b, a%b) +# 端っこをぬかした条件 +# A[0  ]ぬかした場合, R[ 1] +# A[N-1]ぬかした場合, L[-2] +# 端っこ以外をfor文で