# encoding:utf-8

import copy

import random

import bisect #bisect_left　これで二部探索の大小検索が行える

import fractions #最小公倍数などはこっち

import math

import fractions

from functools import reduce







N = int(eval(input()))

A = [int(i) for i in input().split()]



def gcd(nums):

    return reduce(fractions.gcd,nums)



ans = 1

A.sort()

gcd1 = gcd(A)

for i in range(N):

    A[i] //= gcd1



ans *= gcd1



gcd2 = A[0]

for i in range(1,N):

    gcd2 = fractions.gcd(gcd2,A[i])

    if gcd2 == 1:

        key = i

        break



a = copy.deepcopy(A)

a.remove(A[0])

if gcd(a)!=1:

    ans *= gcd(a)

    print(ans)

    exit()



a = copy.deepcopy(A)

a.remove(A[key])

if gcd(a)!=1:

    ans *= gcd(a)

    print(ans)

    exit()

print(ans)

# encoding:utf-8

import copy

import random

import bisect #bisect_left　これで二部探索の大小検索が行える

import fractions #最小公倍数などはこっち

import math

import fractions

from functools import reduce

N = int(eval(input()))

A = [int(i) for i in input().split()]



def gcd(nums):

    return reduce(fractions.gcd,nums)



ans = 1

A.sort()

gcd1 = gcd(A)

for i in range(N):

    A[i] //= gcd1



ans *= gcd1



gcd2 = A[0]

for i in range(1,N):

    gcd2 = fractions.gcd(gcd2,A[i])

    if gcd2 == 1:

        key = i

        break



a = copy.deepcopy(A)

a.remove(A[0])

b = copy.deepcopy(A)

b.remove(A[key])



ans *= max(gcd(a),gcd(b))

print(ans)

# encoding:utf-8
import copy
import random
import bisect  # bisect_left　これで二部探索の大小検索が行える
import fractions  # 最小公倍数などはこっち
import math
import fractions
from functools import reduce

N = int(eval(input()))
A = [int(i) for i in input().split()]


def gcd(nums):
    return reduce(fractions.gcd, nums)


ans = 1
A.sort()
gcd1 = gcd(A)
for i in range(N):
    A[i] //= gcd1
ans *= gcd1
gcd2 = A[0]
for i in range(1, N):
    gcd2 = fractions.gcd(gcd2, A[i])
    if gcd2 == 1:
        key = i
        break
a = copy.deepcopy(A)
a.remove(A[0])
if gcd(a) != 1:
    ans *= gcd(a)
    print(ans)
    exit()
a = copy.deepcopy(A)
a.remove(A[key])
if gcd(a) != 1:
    ans *= gcd(a)
    print(ans)
    exit()
print(ans)

# encoding:utf-8
import copy
import random
import bisect  # bisect_left　これで二部探索の大小検索が行える
import fractions  # 最小公倍数などはこっち
import math
import fractions
from functools import reduce

N = int(eval(input()))
A = [int(i) for i in input().split()]


def gcd(nums):
    return reduce(fractions.gcd, nums)


ans = 1
A.sort()
gcd1 = gcd(A)
for i in range(N):
    A[i] //= gcd1
ans *= gcd1
gcd2 = A[0]
for i in range(1, N):
    gcd2 = fractions.gcd(gcd2, A[i])
    if gcd2 == 1:
        key = i
        break
a = copy.deepcopy(A)
a.remove(A[0])
b = copy.deepcopy(A)
b.remove(A[key])
ans *= max(gcd(a), gcd(b))
print(ans)

-if gcd(a) != 1: -    ans *= gcd(a) -    print(ans) -    exit() -a = copy.deepcopy(A) -a.remove(A[key]) -if gcd(a) != 1: -    ans *= gcd(a) -    print(ans) -    exit() +b = copy.deepcopy(A) +b.remove(A[key]) +ans *= max(gcd(a), gcd(b))