from collections import Counter

from functools import lru_cache

from math import gcd





@lru_cache(maxsize=None)

def get_dividers(n):

    """

    正の整数 n の約数を取得する

    """



    dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}

    return dividers | {n // d for d in dividers}





@lru_cache(maxsize=None)

def lcm(a, b):

    """

    aとbの最小公倍数を計算する

    """



    return a * b // gcd(a, b)





N = int(eval(input()))

A = tuple(map(int, input().split(' ')))



counter = Counter()

for a in A:

    counter.update(get_dividers(a))



ans = 1

candidates = []

for key, value in list(counter.items()):

    if value == N:

        ans = lcm(ans, key)

    elif value == N - 1:

        candidates.append(key)



if candidates:

    ans = max([lcm(ans, c) for c in candidates])



print(ans)

from math import gcd



N = int(eval(input()))

A = tuple(map(int, input().split(' ')))



left = []

right = []



left.append(A[0])

for a in A[1:]:

    left.append(gcd(left[-1], a))



right.append(A[-1])

for a in A[-2::-1]:

    right.append(gcd(right[-1], a))



right = list(reversed(right))



ans = [left[-2], right[1]]



for i in range(1, len(left) - 1):

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



print((max(ans)))

from collections import Counter
from functools import lru_cache
from math import gcd


@lru_cache(maxsize=None)
def get_dividers(n):
    """
    正の整数 n の約数を取得する
    """
    dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0}
    return dividers | {n // d for d in dividers}


@lru_cache(maxsize=None)
def lcm(a, b):
    """
    aとbの最小公倍数を計算する
    """
    return a * b // gcd(a, b)


N = int(eval(input()))
A = tuple(map(int, input().split(" ")))
counter = Counter()
for a in A:
    counter.update(get_dividers(a))
ans = 1
candidates = []
for key, value in list(counter.items()):
    if value == N:
        ans = lcm(ans, key)
    elif value == N - 1:
        candidates.append(key)
if candidates:
    ans = max([lcm(ans, c) for c in candidates])
print(ans)

from math import gcd

N = int(eval(input()))
A = tuple(map(int, input().split(" ")))
left = []
right = []
left.append(A[0])
for a in A[1:]:
    left.append(gcd(left[-1], a))
right.append(A[-1])
for a in A[-2::-1]:
    right.append(gcd(right[-1], a))
right = list(reversed(right))
ans = [left[-2], right[1]]
for i in range(1, len(left) - 1):
    ans.append(gcd(left[i - 1], right[i + 1]))
print((max(ans)))

-from collections import Counter -from functools import lru_cache - - -@lru_cache(maxsize=None) -def get_dividers(n): -    """ -    正の整数 n の約数を取得する -    """ -    dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0} -    return dividers | {n // d for d in dividers} - - -@lru_cache(maxsize=None) -def lcm(a, b): -    """ -    aとbの最小公倍数を計算する -    """ -    return a * b // gcd(a, b) - -counter = Counter() -for a in A: -    counter.update(get_dividers(a)) -ans = 1 -candidates = [] -for key, value in list(counter.items()): -    if value == N: -        ans = lcm(ans, key) -    elif value == N - 1: -        candidates.append(key) -if candidates: -    ans = max([lcm(ans, c) for c in candidates]) -print(ans) +left = [] +right = [] +left.append(A[0]) +for a in A[1:]: +    left.append(gcd(left[-1], a)) +right.append(A[-1]) +for a in A[-2::-1]: +    right.append(gcd(right[-1], a)) +right = list(reversed(right)) +ans = [left[-2], right[1]] +for i in range(1, len(left) - 1): +    ans.append(gcd(left[i - 1], right[i + 1])) +print((max(ans)))