import fractions



N = int(eval(input()))

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

L = [0] * (N+1)

R = [0] * (N+2)

M = [0] * (N+1)



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

  L[i] = fractions.gcd(L[i-1], A[i-1])

  R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i])



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

  M[i] = fractions.gcd(L[i-1], R[i+1])

print((max(M[1:])))

    

import fractions



N = int(eval(input()))

A = [0] + list(map(int, input().split())) + [0]

L = [0] * (N+1)

R = [0] * (N+2)



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

  L[i] = fractions.gcd(L[i-1], A[i-1]) 

  R[N-i+1] = fractions.gcd(R[N-i+2], A[N-i+2])

ans = 0

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

  rest_gcd = fractions.gcd(L[i], R[i])

  ans = max(ans, rest_gcd)

print(ans)

    

import fractions

N = int(eval(input()))
A = list(map(int, input().split()))
L = [0] * (N + 1)
R = [0] * (N + 2)
M = [0] * (N + 1)
for i in range(1, N + 1):
    L[i] = fractions.gcd(L[i - 1], A[i - 1])
    R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i])
for i in range(1, N + 1):
    M[i] = fractions.gcd(L[i - 1], R[i + 1])
print((max(M[1:])))

import fractions

N = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
L = [0] * (N + 1)
R = [0] * (N + 2)
for i in range(1, N + 1):
    L[i] = fractions.gcd(L[i - 1], A[i - 1])
    R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i + 2])
ans = 0
for i in range(1, N + 1):
    rest_gcd = fractions.gcd(L[i], R[i])
    ans = max(ans, rest_gcd)
print(ans)

-A = list(map(int, input().split())) +A = [0] + list(map(int, input().split())) + [0] -M = [0] * (N + 1) -    R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i]) +    R[N - i + 1] = fractions.gcd(R[N - i + 2], A[N - i + 2]) +ans = 0 -    M[i] = fractions.gcd(L[i - 1], R[i + 1]) -print((max(M[1:]))) +    rest_gcd = fractions.gcd(L[i], R[i]) +    ans = max(ans, rest_gcd) +print(ans)