n = int(eval(input()))

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

A.sort()

def find(inte):

    re = []

    for i in range(1,int(inte**0.5)+1):

        if inte%i==0:

            re.append(i)

            if i != inte/i:

                re.append(int(inte/i))

    return set(re)

if n==2:

    print((A[1]))

else:

    a1 = find(A[0])

    a2 = find(A[1])

    a3 = find(A[2])

    t1 = a1 & a2

    t2 = a2 & a3

    t3 = a1 & a3

    cond = t1 | t2 |t3

    maxi = 0

    for con in cond:

        count = 0

        flag = True

        for a in A:

            if a%con != 0:

                count +=1

            if count >= 2:

                

                flag = False

                break

        if flag and maxi < con:

            maxi = con

    print(maxi)
from fractions import gcd

n = int(eval(input()))

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

left = [0]*(n+1)

right = [0]*(n+2)

for a,aa,i in zip(A,A[::-1],list(range(1,n+1))):

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

    right[n+1-i] = gcd(aa,right[n-i+2])

ans = 1

for i in range(1,n+1):

    if i ==1:

        if ans < right[i+1]:

            ans = right[i+1]

    elif i == n:

        if ans < left[i-1]:

            ans = left[i-1]

    else:

        if ans < gcd(left[i-1],right[i+1]):

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



print(ans)

    
n = int(eval(input()))
A = list(map(int, input().split()))
A.sort()


def find(inte):
    re = []
    for i in range(1, int(inte**0.5) + 1):
        if inte % i == 0:
            re.append(i)
            if i != inte / i:
                re.append(int(inte / i))
    return set(re)


if n == 2:
    print((A[1]))
else:
    a1 = find(A[0])
    a2 = find(A[1])
    a3 = find(A[2])
    t1 = a1 & a2
    t2 = a2 & a3
    t3 = a1 & a3
    cond = t1 | t2 | t3
    maxi = 0
    for con in cond:
        count = 0
        flag = True
        for a in A:
            if a % con != 0:
                count += 1
            if count >= 2:
                flag = False
                break
        if flag and maxi < con:
            maxi = con
    print(maxi)

from fractions import gcd

n = int(eval(input()))
A = list(map(int, input().split()))
left = [0] * (n + 1)
right = [0] * (n + 2)
for a, aa, i in zip(A, A[::-1], list(range(1, n + 1))):
    left[i] = gcd(a, left[i - 1])
    right[n + 1 - i] = gcd(aa, right[n - i + 2])
ans = 1
for i in range(1, n + 1):
    if i == 1:
        if ans < right[i + 1]:
            ans = right[i + 1]
    elif i == n:
        if ans < left[i - 1]:
            ans = left[i - 1]
    else:
        if ans < gcd(left[i - 1], right[i + 1]):
            ans = gcd(left[i - 1], right[i + 1])
print(ans)

+from fractions import gcd + -A.sort() - - -def find(inte): -    re = [] -    for i in range(1, int(inte**0.5) + 1): -        if inte % i == 0: -            re.append(i) -            if i != inte / i: -                re.append(int(inte / i)) -    return set(re) - - -if n == 2: -    print((A[1])) -else: -    a1 = find(A[0]) -    a2 = find(A[1]) -    a3 = find(A[2]) -    t1 = a1 & a2 -    t2 = a2 & a3 -    t3 = a1 & a3 -    cond = t1 | t2 | t3 -    maxi = 0 -    for con in cond: -        count = 0 -        flag = True -        for a in A: -            if a % con != 0: -                count += 1 -            if count >= 2: -                flag = False -                break -        if flag and maxi < con: -            maxi = con -    print(maxi) +left = [0] * (n + 1) +right = [0] * (n + 2) +for a, aa, i in zip(A, A[::-1], list(range(1, n + 1))): +    left[i] = gcd(a, left[i - 1]) +    right[n + 1 - i] = gcd(aa, right[n - i + 2]) +ans = 1 +for i in range(1, n + 1): +    if i == 1: +        if ans < right[i + 1]: +            ans = right[i + 1] +    elif i == n: +        if ans < left[i - 1]: +            ans = left[i - 1] +    else: +        if ans < gcd(left[i - 1], right[i + 1]): +            ans = gcd(left[i - 1], right[i + 1]) +print(ans)