import fractions

import functools

import sys



n=int(eval(input()))

a = [int(i) for i in input().split()]

a.sort()



if len(a) == 2:

  print((max(a)))

  sys.exit()

  

gcd_a = functools.reduce(fractions.gcd, a)

a=[i//gcd_a for i in a]



so = 0

cnt = 0

gcd_0 = functools.reduce(fractions.gcd, a[1:])

for i in range(1,len(a)):

  if fractions.gcd(a[0],a[i]) == 1:

    so = i

    cnt+=1

    if cnt == 2:

      print((max(gcd_a,gcd_0*gcd_a)))

      sys.exit()



a_i = [i for i in a if i != a[so]]

gcd_i = functools.reduce(fractions.gcd, a_i)



print((max(gcd_0,gcd_i)*gcd_a))

   

from fractions import gcd

import functools

import sys



n=int(eval(input()))

a = [int(i) for i in input().split()]



left_gcd = [a[0]]

for i in range(1,len(a)):

  left_gcd.append(gcd(left_gcd[-1],a[i]))

#print(left_gcd)

  

right_gcd = [a[-1]]

for i in range(len(a)-1)[::-1]:

  right_gcd.append(gcd(right_gcd[-1],a[i]))

right_gcd = right_gcd[::-1]

#print(right_gcd)



each_gcd = [right_gcd[1]]

for i in range(1,len(a)-1):

  each_gcd.append(gcd(left_gcd[i-1],right_gcd[i+1]))

each_gcd.append(left_gcd[-2])



#print(each_gcd)

print((max(each_gcd)))

             
import fractions
import functools
import sys

n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
if len(a) == 2:
    print((max(a)))
    sys.exit()
gcd_a = functools.reduce(fractions.gcd, a)
a = [i // gcd_a for i in a]
so = 0
cnt = 0
gcd_0 = functools.reduce(fractions.gcd, a[1:])
for i in range(1, len(a)):
    if fractions.gcd(a[0], a[i]) == 1:
        so = i
        cnt += 1
        if cnt == 2:
            print((max(gcd_a, gcd_0 * gcd_a)))
            sys.exit()
a_i = [i for i in a if i != a[so]]
gcd_i = functools.reduce(fractions.gcd, a_i)
print((max(gcd_0, gcd_i) * gcd_a))

from fractions import gcd
import functools
import sys

n = int(eval(input()))
a = [int(i) for i in input().split()]
left_gcd = [a[0]]
for i in range(1, len(a)):
    left_gcd.append(gcd(left_gcd[-1], a[i]))
# print(left_gcd)
right_gcd = [a[-1]]
for i in range(len(a) - 1)[::-1]:
    right_gcd.append(gcd(right_gcd[-1], a[i]))
right_gcd = right_gcd[::-1]
# print(right_gcd)
each_gcd = [right_gcd[1]]
for i in range(1, len(a) - 1):
    each_gcd.append(gcd(left_gcd[i - 1], right_gcd[i + 1]))
each_gcd.append(left_gcd[-2])
# print(each_gcd)
print((max(each_gcd)))

-import fractions +from fractions import gcd -a.sort() -if len(a) == 2: -    print((max(a))) -    sys.exit() -gcd_a = functools.reduce(fractions.gcd, a) -a = [i // gcd_a for i in a] -so = 0 -cnt = 0 -gcd_0 = functools.reduce(fractions.gcd, a[1:]) +left_gcd = [a[0]] -    if fractions.gcd(a[0], a[i]) == 1: -        so = i -        cnt += 1 -        if cnt == 2: -            print((max(gcd_a, gcd_0 * gcd_a))) -            sys.exit() -a_i = [i for i in a if i != a[so]] -gcd_i = functools.reduce(fractions.gcd, a_i) -print((max(gcd_0, gcd_i) * gcd_a)) +    left_gcd.append(gcd(left_gcd[-1], a[i])) +# print(left_gcd) +right_gcd = [a[-1]] +for i in range(len(a) - 1)[::-1]: +    right_gcd.append(gcd(right_gcd[-1], a[i])) +right_gcd = right_gcd[::-1] +# print(right_gcd) +each_gcd = [right_gcd[1]] +for i in range(1, len(a) - 1): +    each_gcd.append(gcd(left_gcd[i - 1], right_gcd[i + 1])) +each_gcd.append(left_gcd[-2]) +# print(each_gcd) +print((max(each_gcd)))