def gcdf(a):

    a.sort()

    a0=a[0]

    a=[int(x%a0) for x in a if x%a0 != 0]

    if len(a)==0:

        return a0

    else:

        a.append(a0)

        a0=min(a)

        return gcdf(a) 



n=int(eval(input()))

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



if n==2:

    print((max(a)))

elif n<2**8:

    gcdv=0

    for i in range(n):

        acpy=list(a)

        del acpy[i]

        gcdx=gcdf(acpy)

        if gcdx>gcdv:

            gcdv=gcdx

    print(gcdv)

else:

    m=int(n/100)

    ns=int(n/m)

    rgcd=[]

    for mi in range(m):

        ms=ns*mi

        if mi==m-1:

            am=a[ms:n]

        else:

            am=a[ms:ms+ns]

        gcdm=gcdf(am)

        rgcd.append(gcdm)

    gcdv=0



    for mi in range(m):

        rgcd1=list(rgcd)

        del rgcd1[mi]

        gcdrg1=gcdf(rgcd1)

        ms=ns*mi

        if mi==m-1:

            am=a[ms:n]

        else:

            am=a[ms:ms+ns]

#        print(mi,gcdf(am),len(am),gcdf(rgcd1))

        for i in range(len(am)):

            acpy=list(am)

#            del acpy[i]

#            acpy.append(gcdrg1)

            acpy[i]=gcdrg1

            gcdx=gcdf(acpy)

            if gcdx>gcdv:

                gcdv=gcdx

    print(gcdv)

# ==================== gcd   最大公約数

from fractions import gcd

#from math import gcd



n=int(eval(input()))

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



l=[0]*(n+1)

r=[0]*(n+1)



for i in range(n):

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

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



mimax=1

for i in range(n):

    mi=gcd(l[i],r[i+1])

    mimax=max(mi,mimax)

   

print(mimax)
def gcdf(a):
    a.sort()
    a0 = a[0]
    a = [int(x % a0) for x in a if x % a0 != 0]
    if len(a) == 0:
        return a0
    else:
        a.append(a0)
        a0 = min(a)
        return gcdf(a)


n = int(eval(input()))
a = list(map(int, input().split()))
if n == 2:
    print((max(a)))
elif n < 2**8:
    gcdv = 0
    for i in range(n):
        acpy = list(a)
        del acpy[i]
        gcdx = gcdf(acpy)
        if gcdx > gcdv:
            gcdv = gcdx
    print(gcdv)
else:
    m = int(n / 100)
    ns = int(n / m)
    rgcd = []
    for mi in range(m):
        ms = ns * mi
        if mi == m - 1:
            am = a[ms:n]
        else:
            am = a[ms : ms + ns]
        gcdm = gcdf(am)
        rgcd.append(gcdm)
    gcdv = 0
    for mi in range(m):
        rgcd1 = list(rgcd)
        del rgcd1[mi]
        gcdrg1 = gcdf(rgcd1)
        ms = ns * mi
        if mi == m - 1:
            am = a[ms:n]
        else:
            am = a[ms : ms + ns]
        #        print(mi,gcdf(am),len(am),gcdf(rgcd1))
        for i in range(len(am)):
            acpy = list(am)
            #            del acpy[i]
            #            acpy.append(gcdrg1)
            acpy[i] = gcdrg1
            gcdx = gcdf(acpy)
            if gcdx > gcdv:
                gcdv = gcdx
    print(gcdv)

# ==================== gcd   最大公約数
from fractions import gcd

# from math import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * (n + 1)
r = [0] * (n + 1)
for i in range(n):
    l[i + 1] = gcd(l[i], a[i])
    r[n - i - 1] = gcd(r[n - i], a[n - i - 1])
mimax = 1
for i in range(n):
    mi = gcd(l[i], r[i + 1])
    mimax = max(mi, mimax)
print(mimax)

-def gcdf(a): -    a.sort() -    a0 = a[0] -    a = [int(x % a0) for x in a if x % a0 != 0] -    if len(a) == 0: -        return a0 -    else: -        a.append(a0) -        a0 = min(a) -        return gcdf(a) +# ==================== gcd   最大公約数 +from fractions import gcd - +# from math import gcd -if n == 2: -    print((max(a))) -elif n < 2**8: -    gcdv = 0 -    for i in range(n): -        acpy = list(a) -        del acpy[i] -        gcdx = gcdf(acpy) -        if gcdx > gcdv: -            gcdv = gcdx -    print(gcdv) -else: -    m = int(n / 100) -    ns = int(n / m) -    rgcd = [] -    for mi in range(m): -        ms = ns * mi -        if mi == m - 1: -            am = a[ms:n] -        else: -            am = a[ms : ms + ns] -        gcdm = gcdf(am) -        rgcd.append(gcdm) -    gcdv = 0 -    for mi in range(m): -        rgcd1 = list(rgcd) -        del rgcd1[mi] -        gcdrg1 = gcdf(rgcd1) -        ms = ns * mi -        if mi == m - 1: -            am = a[ms:n] -        else: -            am = a[ms : ms + ns] -        #        print(mi,gcdf(am),len(am),gcdf(rgcd1)) -        for i in range(len(am)): -            acpy = list(am) -            #            del acpy[i] -            #            acpy.append(gcdrg1) -            acpy[i] = gcdrg1 -            gcdx = gcdf(acpy) -            if gcdx > gcdv: -                gcdv = gcdx -    print(gcdv) +l = [0] * (n + 1) +r = [0] * (n + 1) +for i in range(n): +    l[i + 1] = gcd(l[i], a[i]) +    r[n - i - 1] = gcd(r[n - i], a[n - i - 1]) +mimax = 1 +for i in range(n): +    mi = gcd(l[i], r[i + 1]) +    mimax = max(mi, mimax) +print(mimax)