

'''

- [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97)

- [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python)

'''



from fractions import gcd



n = int(eval(input()))

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



#累積GCD

left = [0] * (n + 1)

right = [0] * (n + 1)

for i in range(n):

    left[i + 1] = (gcd(left[i],a[i]))

    right[n - i - 1] = (gcd(right[n - i],a[n - 1 - i]))



'''

5

64 48 16 18 12

の場合、



n = 0〜4

left:

    0 = 0

    1 = gcd(l[0], a[0]) → gcd(a[0])

    2 = gcd(l[1], a[1]) → gcd(a[0] + a[1])

    3 = gcd(l[2], a[2]) → gcd(a[0] + a[1] + a[2])

    4 = gcd(l[3], a[3]) → gcd(a[0] + a[1] + a[2] + a[3])

    5 = gcd(l[4], a[4]) → gcd(a[0] + a[1] + a[2] + a[3] + a[4])



right:

    5 = 0

    4 = gcd(r[5], a[4]) → gcd(a[4])

    3 = gcd(r[4], a[3]) → gcd(a[4] + a[3])

    2 = gcd(r[3], a[2]) → gcd(a[4] + a[3] + a[2])

    1 = gcd(r[2], a[1]) → gcd(a[4] + a[3] + a[2] + a[1])

    0 = gcd(r[1], a[0]) → gcd(a[4] + a[3] + a[2] + a[1] + a[0])

'''



ans = 0

for i in range(n):

    ans = max(ans, gcd(left[i],right[i + 1]))



    '''

    n = 0〜4

    gcd(l[0], r[1])  a[0] と a[4]〜a[1] のgcd :        a除外なし(全部同一の値のケース)

    gcd(l[1], r[2])  a[0] と a[4]〜a[2] のgcd :        a[1]を除外

    gcd(l[2], r[3])  a[0]〜a[1] と a[4]〜a[3] のgcd :  a[2]を除外

    gcd(l[3], r[4])  a[0]〜a[2] と a[4] のgcd :        a[3]を除外

    gcd(l[4], r[5])  a[0]〜a[3] と 0 の gcd :          a[4]を除外

    '''



print(ans)



import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**6)

##############################



from fractions import gcd



N = int(eval(input()))

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



# 累積gcdを左からと右から

left = [0] * N

right = [0] * N

left[0] = A[0]

for i in range(1, N):

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



right[N-1] = A[N-1]

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

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



# 番兵

left = [A[N-1]] + left

right.append(A[0])



#print(left)

#print(right)



ans = 0

for i in range(N):

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

    ans = max(ans, x)



print(ans)
"""
- [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97)
- [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python)
"""
from fractions import gcd

n = int(eval(input()))
a = list(map(int, input().split()))
# 累積GCD
left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = gcd(left[i], a[i])
    right[n - i - 1] = gcd(right[n - i], a[n - 1 - i])
"""
5
64 48 16 18 12
の場合、
n = 0〜4
left:
    0 = 0
    1 = gcd(l[0], a[0]) → gcd(a[0])
    2 = gcd(l[1], a[1]) → gcd(a[0] + a[1])
    3 = gcd(l[2], a[2]) → gcd(a[0] + a[1] + a[2])
    4 = gcd(l[3], a[3]) → gcd(a[0] + a[1] + a[2] + a[3])
    5 = gcd(l[4], a[4]) → gcd(a[0] + a[1] + a[2] + a[3] + a[4])
right:
    5 = 0
    4 = gcd(r[5], a[4]) → gcd(a[4])
    3 = gcd(r[4], a[3]) → gcd(a[4] + a[3])
    2 = gcd(r[3], a[2]) → gcd(a[4] + a[3] + a[2])
    1 = gcd(r[2], a[1]) → gcd(a[4] + a[3] + a[2] + a[1])
    0 = gcd(r[1], a[0]) → gcd(a[4] + a[3] + a[2] + a[1] + a[0])
"""
ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i + 1]))
    """
    n = 0〜4
    gcd(l[0], r[1])  a[0] と a[4]〜a[1] のgcd :        a除外なし(全部同一の値のケース)
    gcd(l[1], r[2])  a[0] と a[4]〜a[2] のgcd :        a[1]を除外
    gcd(l[2], r[3])  a[0]〜a[1] と a[4]〜a[3] のgcd :  a[2]を除外
    gcd(l[3], r[4])  a[0]〜a[2] と a[4] のgcd :        a[3]を除外
    gcd(l[4], r[5])  a[0]〜a[3] と 0 の gcd :          a[4]を除外
    """
print(ans)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
from fractions import gcd

N = int(eval(input()))
A = list(map(int, input().split()))
# 累積gcdを左からと右から
left = [0] * N
right = [0] * N
left[0] = A[0]
for i in range(1, N):
    left[i] = gcd(left[i - 1], A[i])
right[N - 1] = A[N - 1]
for i in range(N - 2, -1, -1):
    right[i] = gcd(A[i], right[i + 1])
# 番兵
left = [A[N - 1]] + left
right.append(A[0])
# print(left)
# print(right)
ans = 0
for i in range(N):
    x = gcd(left[i], right[i + 1])
    ans = max(ans, x)
print(ans)

-""" -- [ABC125 - C - GCD on Blackboard(300点)](https://qiita.com/hkrutknouch/items/e71488de4a0c8e83ee97) -- [累積GCDでAtCoder ABC 125 C – GCD on Blackboardを解く](https://muroiwataru.net/entry/abc-125-python) -""" +import sys + +input = sys.stdin.readline +sys.setrecursionlimit(10**6) +############################## -n = int(eval(input())) -a = list(map(int, input().split())) -# 累積GCD -left = [0] * (n + 1) -right = [0] * (n + 1) -for i in range(n): -    left[i + 1] = gcd(left[i], a[i]) -    right[n - i - 1] = gcd(right[n - i], a[n - 1 - i]) -""" -5 -64 48 16 18 12 -の場合、 -n = 0〜4 -left: -    0 = 0 -    1 = gcd(l[0], a[0]) → gcd(a[0]) -    2 = gcd(l[1], a[1]) → gcd(a[0] + a[1]) -    3 = gcd(l[2], a[2]) → gcd(a[0] + a[1] + a[2]) -    4 = gcd(l[3], a[3]) → gcd(a[0] + a[1] + a[2] + a[3]) -    5 = gcd(l[4], a[4]) → gcd(a[0] + a[1] + a[2] + a[3] + a[4]) -right: -    5 = 0 -    4 = gcd(r[5], a[4]) → gcd(a[4]) -    3 = gcd(r[4], a[3]) → gcd(a[4] + a[3]) -    2 = gcd(r[3], a[2]) → gcd(a[4] + a[3] + a[2]) -    1 = gcd(r[2], a[1]) → gcd(a[4] + a[3] + a[2] + a[1]) -    0 = gcd(r[1], a[0]) → gcd(a[4] + a[3] + a[2] + a[1] + a[0]) -""" +N = int(eval(input())) +A = list(map(int, input().split())) +# 累積gcdを左からと右から +left = [0] * N +right = [0] * N +left[0] = A[0] +for i in range(1, N): +    left[i] = gcd(left[i - 1], A[i]) +right[N - 1] = A[N - 1] +for i in range(N - 2, -1, -1): +    right[i] = gcd(A[i], right[i + 1]) +# 番兵 +left = [A[N - 1]] + left +right.append(A[0]) +# print(left) +# print(right) -for i in range(n): -    ans = max(ans, gcd(left[i], right[i + 1])) -    """ -    n = 0〜4 -    gcd(l[0], r[1])  a[0] と a[4]〜a[1] のgcd :        a除外なし(全部同一の値のケース) -    gcd(l[1], r[2])  a[0] と a[4]〜a[2] のgcd :        a[1]を除外 -    gcd(l[2], r[3])  a[0]〜a[1] と a[4]〜a[3] のgcd :  a[2]を除外 -    gcd(l[3], r[4])  a[0]〜a[2] と a[4] のgcd :        a[3]を除外 -    gcd(l[4], r[5])  a[0]〜a[3] と 0 の gcd :          a[4]を除外 -    """ +for i in range(N): +    x = gcd(left[i], right[i + 1]) +    ans = max(ans, x)