

# coding: utf-8



# In[1]:



import sys

input = sys.stdin.readline

N = int(eval(input()))

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





# In[2]:



#import copy

#import numpy as np

try:

    from fractions import gcd

except:

    from math import gcd





# In[ ]:



# 左からn個の最大公約数を求める O(n)

# 右からn個の最大公約数を求める O(n)

# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数





# In[3]:



lg = [1]*(N)

rg = [1]*(N)

ans = 0





# In[4]:



#print(lg)

#print(rg)

#print(A)





# In[5]:



lg[0] = A[1]

rg[0] = A[N-2]

lg[1] = A[0]

rg[1] = A[N-1]

#print(lg, rg)

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

    #print(i)

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

    #print(lg[i], A[i])

    rg[i+1] = gcd(rg[i], A[N-1-i])

    #print(rg[N-1-i], A[N-1-i])

#print(lg, rg)



for i in range(N):

    #print(i, lg[i], rg[N-i-1])

    tmp = gcd(lg[i], rg[N-i-1])

    #print(tmp)

    if ans < tmp:

        ans = tmp

    #print(ans)





# In[6]:



print(ans)





# In[ ]:



"""

[42 54 69 92 12 23]のとき

 1 [54 69 92 12 23]の最大公約数

 2 [42 69 92 12 23]

 3 [42 54 92 12 23]

 4 [42 54 69 12 23]



"""





# coding: utf-8



# In[1]:



import sys

input = sys.stdin.readline

N = int(eval(input()))

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





# In[2]:



#import copy

#import numpy as np

try:

    from fractions import gcd

except:

    from math import gcd





# In[ ]:



# 左からn個の最大公約数を求める O(n)

# 右からn個の最大公約数を求める O(n)

# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数





# In[3]:



lg = [1]*(N)

rg = [1]*(N)

ans = 0





# In[4]:



#print(lg)

#print(rg)

#print(A)





# In[ ]:



lg[0] = A[1]

rg[0] = A[N-2]

lg[1] = A[0]

rg[1] = A[N-1]

#print(lg, rg)

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

    #print(i)

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

    #print(lg[i], A[i])

    rg[i+1] = gcd(rg[i], A[N-1-i])

    #print(rg[N-1-i], A[N-1-i])

#print(lg, rg)



#ans = [0]*N

ans = [gcd(lg[i], rg[N-1-i]) for i in range(N)]

#for i in range(N):

    #print(i, lg[i], rg[N-i-1])

    #ans = gcd(lg[i], rg[N-i-1])

print((max(ans)))





# In[6]:



#print(ans)



# coding: utf-8
# In[1]:
import sys

input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
# In[2]:
# import copy
# import numpy as np
try:
    from fractions import gcd
except:
    from math import gcd
# In[ ]:
# 左からn個の最大公約数を求める O(n)
# 右からn個の最大公約数を求める O(n)
# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数
# In[3]:
lg = [1] * (N)
rg = [1] * (N)
ans = 0
# In[4]:
# print(lg)
# print(rg)
# print(A)
# In[5]:
lg[0] = A[1]
rg[0] = A[N - 2]
lg[1] = A[0]
rg[1] = A[N - 1]
# print(lg, rg)
for i in range(1, N - 1):
    # print(i)
    lg[i + 1] = gcd(lg[i], A[i])
    # print(lg[i], A[i])
    rg[i + 1] = gcd(rg[i], A[N - 1 - i])
    # print(rg[N-1-i], A[N-1-i])
# print(lg, rg)
for i in range(N):
    # print(i, lg[i], rg[N-i-1])
    tmp = gcd(lg[i], rg[N - i - 1])
    # print(tmp)
    if ans < tmp:
        ans = tmp
    # print(ans)
# In[6]:
print(ans)
# In[ ]:
"""
[42 54 69 92 12 23]のとき
 1 [54 69 92 12 23]の最大公約数
 2 [42 69 92 12 23]
 3 [42 54 92 12 23]
 4 [42 54 69 12 23]
"""

# coding: utf-8
# In[1]:
import sys

input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
# In[2]:
# import copy
# import numpy as np
try:
    from fractions import gcd
except:
    from math import gcd
# In[ ]:
# 左からn個の最大公約数を求める O(n)
# 右からn個の最大公約数を求める O(n)
# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数
# In[3]:
lg = [1] * (N)
rg = [1] * (N)
ans = 0
# In[4]:
# print(lg)
# print(rg)
# print(A)
# In[ ]:
lg[0] = A[1]
rg[0] = A[N - 2]
lg[1] = A[0]
rg[1] = A[N - 1]
# print(lg, rg)
for i in range(1, N - 1):
    # print(i)
    lg[i + 1] = gcd(lg[i], A[i])
    # print(lg[i], A[i])
    rg[i + 1] = gcd(rg[i], A[N - 1 - i])
    # print(rg[N-1-i], A[N-1-i])
# print(lg, rg)
# ans = [0]*N
ans = [gcd(lg[i], rg[N - 1 - i]) for i in range(N)]
# for i in range(N):
# print(i, lg[i], rg[N-i-1])
# ans = gcd(lg[i], rg[N-i-1])
print((max(ans)))
# In[6]:
# print(ans)

-# In[5]: +# In[ ]: -for i in range(N): -    # print(i, lg[i], rg[N-i-1]) -    tmp = gcd(lg[i], rg[N - i - 1]) -    # print(tmp) -    if ans < tmp: -        ans = tmp -    # print(ans) +# ans = [0]*N +ans = [gcd(lg[i], rg[N - 1 - i]) for i in range(N)] +# for i in range(N): +# print(i, lg[i], rg[N-i-1]) +# ans = gcd(lg[i], rg[N-i-1]) +print((max(ans))) -print(ans) -# In[ ]: -""" -[42 54 69 92 12 23]のとき - 1 [54 69 92 12 23]の最大公約数 - 2 [42 69 92 12 23] - 3 [42 54 92 12 23] - 4 [42 54 69 12 23] -""" +# print(ans)