def gcd(a,b):

    if b>a:

        a,b=b,a

    while b:

        a,b=b, a%b

    return a



def cul(n,x):

    l=len(x)

    b=[x[i] for i in range(l)]

    b.pop(n)

    tmp=b[0]

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

        tmp=gcd(tmp,b[i])

    return tmp



import sys

p=100

N=int(eval(input()))

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

if N<=p:

    ans=0

    

    for i in range(N):

        tmp=cul(i,a)        

        if tmp>ans: ans=tmp

    print(ans)

    sys.exit()



ans=0

for i in range(p):

    s=cul(i,a[:p])

    if s>ans: ans=s



print(ans)
def gcd(a,b):

    if b>a:

        a,b=b,a

    while b:

        a,b=b, a%b

    return a



def cul(n,x):

    l=len(x)

    b=[x[i] for i in range(l)]

    b.pop(n)

    tmp=b[0]

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

        tmp=gcd(tmp,b[i])

    return tmp



import sys

p=50

N=int(eval(input()))

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

if N<=p:

    ans=0

    

    for i in range(N):

        tmp=cul(i,a)        

        if tmp>ans: ans=tmp

    print(ans)

    sys.exit()



ans=0

for i in range(p):

    s=cul(i,a[:p])

    if s>ans: ans=s



print(ans)

def gcd(a, b):
    if b > a:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a


def cul(n, x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1, l - 1):
        tmp = gcd(tmp, b[i])
    return tmp


import sys

p = 100
N = int(eval(input()))
a = list(map(int, input().split()))
if N <= p:
    ans = 0
    for i in range(N):
        tmp = cul(i, a)
        if tmp > ans:
            ans = tmp
    print(ans)
    sys.exit()
ans = 0
for i in range(p):
    s = cul(i, a[:p])
    if s > ans:
        ans = s
print(ans)

def gcd(a, b):
    if b > a:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a


def cul(n, x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1, l - 1):
        tmp = gcd(tmp, b[i])
    return tmp


import sys

p = 50
N = int(eval(input()))
a = list(map(int, input().split()))
if N <= p:
    ans = 0
    for i in range(N):
        tmp = cul(i, a)
        if tmp > ans:
            ans = tmp
    print(ans)
    sys.exit()
ans = 0
for i in range(p):
    s = cul(i, a[:p])
    if s > ans:
        ans = s
print(ans)

-p = 100 +p = 50