from fractions import gcd

import sys

input = sys.stdin.readline



N = int(eval(input()))

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



l_gcd_list = [0]*(N+1)

r_gcd_list = [0]*(N+1)

for i in range(N):

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

    r_gcd_list[-(i+2)] = (gcd(r_gcd_list[-(i+1)], A[-(i+1)]))

# print(l_gcd_list)

# print(r_gcd_list)



results = []

for i in range(N):

    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))



print((max(results)))

import sys

input = sys.stdin.readline



from fractions import gcd



N = int(eval(input()))

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



l_gcd_list = [0]

r_gcd_list = [0]

for i in range(N):

    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))

    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i+1)]))

r_gcd_list = r_gcd_list[::-1]

# print(l_gcd_list)

# print(r_gcd_list)



results = []

for i in range(N):

    results.append(gcd(l_gcd_list[i], r_gcd_list[i+1]))



print((max(results)))

from fractions import gcd
import sys

input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
l_gcd_list = [0] * (N + 1)
r_gcd_list = [0] * (N + 1)
for i in range(N):
    l_gcd_list[i + 1] = gcd(l_gcd_list[i], A[i])
    r_gcd_list[-(i + 2)] = gcd(r_gcd_list[-(i + 1)], A[-(i + 1)])
# print(l_gcd_list)
# print(r_gcd_list)
results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i + 1]))
print((max(results)))

import sys

input = sys.stdin.readline
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
l_gcd_list = [0]
r_gcd_list = [0]
for i in range(N):
    l_gcd_list.append(gcd(l_gcd_list[i], A[i]))
    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i + 1)]))
r_gcd_list = r_gcd_list[::-1]
# print(l_gcd_list)
# print(r_gcd_list)
results = []
for i in range(N):
    results.append(gcd(l_gcd_list[i], r_gcd_list[i + 1]))
print((max(results)))

-from fractions import gcd +from fractions import gcd + -l_gcd_list = [0] * (N + 1) -r_gcd_list = [0] * (N + 1) +l_gcd_list = [0] +r_gcd_list = [0] -    l_gcd_list[i + 1] = gcd(l_gcd_list[i], A[i]) -    r_gcd_list[-(i + 2)] = gcd(r_gcd_list[-(i + 1)], A[-(i + 1)]) +    l_gcd_list.append(gcd(l_gcd_list[i], A[i])) +    r_gcd_list.append(gcd(r_gcd_list[i], A[-(i + 1)])) +r_gcd_list = r_gcd_list[::-1]