# coding: utf-8

from fractions import gcd

N = int(eval(input()))

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

l1, l2 = [0] * N, [0] * N

# 左からGCD

for i in range(1, N):

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

# 右からGCD

for i in range(N-1)[::-1]:

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

ll = []

ans = 0

for i in range(N):

    ans = max(ans, gcd(l1[i], l2[i]))

print(ans)





# coding: utf-8

from fractions import gcd

N = int(eval(input()))

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

l1 = [0] * N

l2 = [0] * N

for i in range(1, N):

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

for i in range(N-1)[::-1]:

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

ans = 0

for i in range(N):

    ans = max(ans, gcd(l1[i], l2[i]))

print(ans)
# coding: utf-8
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
l1, l2 = [0] * N, [0] * N
# 左からGCD
for i in range(1, N):
    l1[i] = gcd(l1[i - 1], A[i - 1])
# 右からGCD
for i in range(N - 1)[::-1]:
    l2[i] = gcd(l2[i + 1], A[i + 1])
ll = []
ans = 0
for i in range(N):
    ans = max(ans, gcd(l1[i], l2[i]))
print(ans)

# coding: utf-8
from fractions import gcd

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

-l1, l2 = [0] * N, [0] * N -# 左からGCD +l1 = [0] * N +l2 = [0] * N -# 右からGCD -ll = []