

n = int(eval(input()))



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

a.sort(reverse=True)





from functools import lru_cache

import sys

if n == 2:

    print((max(a)))

    sys.exit()





@lru_cache(maxsize=100000)

def gcd(x, y):

    while y:

        x, y = y, x % y

    return x





def gcd_list(li):

    if len(li) == 1:

        return li[0]

    g = gcd(li[0], li[1])

    for i in range(2, len(li)):

        g = gcd(g, li[i])

    return g





def gcd_list_2(li):

    g = gcd(li[0], li[1])

    if g == 1:

        return max(gcd_list([li[0]] + li[2:]), gcd_list(li[1:]))

    for i in range(2, n):

        if gcd(g, li[i]) == 1:

            if i == n - 1:

                return gcd_list(li[:i])

            gg = gcd_list(li[i+1:])

            bb = [gcd(li[x], gg) for x in range(i+1)]

            bb.sort()

            return bb[1]

        else:

            g = gcd(g, li[i])

    return g





def max_gcd(a):

    g = gcd_list(a)

    a = [a[i]//g for i in range(n)]

    m = gcd_list_2(a)

    print((g * m))





max_gcd(a)


n = int(eval(input()))

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





import sys

if n == 2:

    print((max(a)))

    sys.exit()





def gcd(x, y):

    while y:

        x, y = y, x % y

    return x





g = a[0]

gcd_left = [g]

for i in range(n-1):

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

    gcd_left.append(g)



g = a[n-1]

gcd_right = [g]

for i in range(n-1):

    g = gcd(g, a[n-2-i])

    gcd_right.append(g)



max_gcd = gcd_right[n-2]

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

    max_gcd = max(max_gcd, gcd(gcd_left[i-1], gcd_right[n - 2 - i]))

max_gcd = max(max_gcd, gcd_left[n-2])



print(max_gcd)
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse=True)
from functools import lru_cache
import sys

if n == 2:
    print((max(a)))
    sys.exit()


@lru_cache(maxsize=100000)
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


def gcd_list(li):
    if len(li) == 1:
        return li[0]
    g = gcd(li[0], li[1])
    for i in range(2, len(li)):
        g = gcd(g, li[i])
    return g


def gcd_list_2(li):
    g = gcd(li[0], li[1])
    if g == 1:
        return max(gcd_list([li[0]] + li[2:]), gcd_list(li[1:]))
    for i in range(2, n):
        if gcd(g, li[i]) == 1:
            if i == n - 1:
                return gcd_list(li[:i])
            gg = gcd_list(li[i + 1 :])
            bb = [gcd(li[x], gg) for x in range(i + 1)]
            bb.sort()
            return bb[1]
        else:
            g = gcd(g, li[i])
    return g


def max_gcd(a):
    g = gcd_list(a)
    a = [a[i] // g for i in range(n)]
    m = gcd_list_2(a)
    print((g * m))


max_gcd(a)

n = int(eval(input()))
a = list(map(int, input().split()))
import sys

if n == 2:
    print((max(a)))
    sys.exit()


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


g = a[0]
gcd_left = [g]
for i in range(n - 1):
    g = gcd(g, a[i + 1])
    gcd_left.append(g)
g = a[n - 1]
gcd_right = [g]
for i in range(n - 1):
    g = gcd(g, a[n - 2 - i])
    gcd_right.append(g)
max_gcd = gcd_right[n - 2]
for i in range(1, n - 1):
    max_gcd = max(max_gcd, gcd(gcd_left[i - 1], gcd_right[n - 2 - i]))
max_gcd = max(max_gcd, gcd_left[n - 2])
print(max_gcd)

-a.sort(reverse=True) -from functools import lru_cache -@lru_cache(maxsize=100000) -def gcd_list(li): -    if len(li) == 1: -        return li[0] -    g = gcd(li[0], li[1]) -    for i in range(2, len(li)): -        g = gcd(g, li[i]) -    return g - - -def gcd_list_2(li): -    g = gcd(li[0], li[1]) -    if g == 1: -        return max(gcd_list([li[0]] + li[2:]), gcd_list(li[1:])) -    for i in range(2, n): -        if gcd(g, li[i]) == 1: -            if i == n - 1: -                return gcd_list(li[:i]) -            gg = gcd_list(li[i + 1 :]) -            bb = [gcd(li[x], gg) for x in range(i + 1)] -            bb.sort() -            return bb[1] -        else: -            g = gcd(g, li[i]) -    return g - - -def max_gcd(a): -    g = gcd_list(a) -    a = [a[i] // g for i in range(n)] -    m = gcd_list_2(a) -    print((g * m)) - - -max_gcd(a) +g = a[0] +gcd_left = [g] +for i in range(n - 1): +    g = gcd(g, a[i + 1]) +    gcd_left.append(g) +g = a[n - 1] +gcd_right = [g] +for i in range(n - 1): +    g = gcd(g, a[n - 2 - i]) +    gcd_right.append(g) +max_gcd = gcd_right[n - 2] +for i in range(1, n - 1): +    max_gcd = max(max_gcd, gcd(gcd_left[i - 1], gcd_right[n - 2 - i])) +max_gcd = max(max_gcd, gcd_left[n - 2]) +print(max_gcd)