import math



N = int(eval(input()))

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



def gcd(a,b):

    if b == 0:

        return a

    return gcd(b,a%b)



M = A[-1]

P = [1,M]

for k in range(2,math.ceil(math.sqrt(M))+1):

    if M % k == 0:

        P.append(k)

        P.append(M//k)

M = A[-2]

P.append(M)

for k in range(2,math.ceil(math.sqrt(M))+1):

    if M % k == 0:

        P.append(k)

        P.append(M//k)

P = set(list(P))

ans = 1

for p in P:

    t = 0

    for k in range(N):

        if A[k]%p != 0:

            t += 1

        if t == 2:

            break

    if t <= 1:

        ans = max(ans,p)



print(ans)

import math

N = int(eval(input()))

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



def yakusuu(a):

    P = [a]

    for k in range(2,math.floor(math.sqrt(a))+1):

        if a % k == 0:

            P.append(k)

            P.append(a//k)

    return P



P = set(yakusuu(A[-1])+yakusuu(A[-2]))

ans = 1

for e in P:

    f = 0

    for a in A:

        if a%e != 0:

            f += 1

        if f == 2:

            break

    if f <= 1:

        ans = max(ans,e)

print(ans)

import math

N = int(eval(input()))
A = sorted(list(map(int, input().split())))


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


M = A[-1]
P = [1, M]
for k in range(2, math.ceil(math.sqrt(M)) + 1):
    if M % k == 0:
        P.append(k)
        P.append(M // k)
M = A[-2]
P.append(M)
for k in range(2, math.ceil(math.sqrt(M)) + 1):
    if M % k == 0:
        P.append(k)
        P.append(M // k)
P = set(list(P))
ans = 1
for p in P:
    t = 0
    for k in range(N):
        if A[k] % p != 0:
            t += 1
        if t == 2:
            break
    if t <= 1:
        ans = max(ans, p)
print(ans)

import math

N = int(eval(input()))
A = sorted(list(map(int, input().split())))


def yakusuu(a):
    P = [a]
    for k in range(2, math.floor(math.sqrt(a)) + 1):
        if a % k == 0:
            P.append(k)
            P.append(a // k)
    return P


P = set(yakusuu(A[-1]) + yakusuu(A[-2]))
ans = 1
for e in P:
    f = 0
    for a in A:
        if a % e != 0:
            f += 1
        if f == 2:
            break
    if f <= 1:
        ans = max(ans, e)
print(ans)

-def gcd(a, b): -    if b == 0: -        return a -    return gcd(b, a % b) +def yakusuu(a): +    P = [a] +    for k in range(2, math.floor(math.sqrt(a)) + 1): +        if a % k == 0: +            P.append(k) +            P.append(a // k) +    return P -M = A[-1] -P = [1, M] -for k in range(2, math.ceil(math.sqrt(M)) + 1): -    if M % k == 0: -        P.append(k) -        P.append(M // k) -M = A[-2] -P.append(M) -for k in range(2, math.ceil(math.sqrt(M)) + 1): -    if M % k == 0: -        P.append(k) -        P.append(M // k) -P = set(list(P)) +P = set(yakusuu(A[-1]) + yakusuu(A[-2])) -for p in P: -    t = 0 -    for k in range(N): -        if A[k] % p != 0: -            t += 1 -        if t == 2: +for e in P: +    f = 0 +    for a in A: +        if a % e != 0: +            f += 1 +        if f == 2: -    if t <= 1: -        ans = max(ans, p) +    if f <= 1: +        ans = max(ans, e)