For the multiset of positive integers $s=\{s_1,s_2,\dots,s_k\}$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $s$ as follow: $\gcd(s)$ is the maximum positive integer $x$, such that all integers in $s$ are divisible on $x$. $\textrm{lcm}(s)$ is the minimum positive integer $x$, that divisible on all integers from $s$.

For example, $\gcd(\{8,12\})=4,\gcd(\{12,18,6\})=6$ and $\textrm{lcm}(\{4,6\})=12$. Note that for any positive integer $x$, $\gcd(\{x\})=\textrm{lcm}(\{x\})=x$.

Orac has a sequence $a$ with length $n$. He come up with the multiset $t=\{\textrm{lcm}(\{a_i,a_j\})\ |\ i<j\}$, and asked you to find the value of $\gcd(t)$ for him. In other words, you need to calculate the GCD of LCMs of all pairs of elements in the given sequence.


-----Input-----

The first line contains one integer $n\ (2\le n\le 100\,000)$.

The second line contains $n$ integers, $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 200\,000$).


-----Output-----

Print one integer: $\gcd(\{\textrm{lcm}(\{a_i,a_j\})\ |\ i<j\})$.


-----Examples-----
Input
2
1 1

Output
1

Input
4
10 24 40 80

Output
40

Input
10
540 648 810 648 720 540 594 864 972 648

Output
54



-----Note-----

For the first example, $t=\{\textrm{lcm}(\{1,1\})\}=\{1\}$, so $\gcd(t)=1$.

For the second example, $t=\{120,40,80,120,240,80\}$, and it's not hard to see that $\gcd(t)=40$.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Number theory

Data structures

Mathematics


Solutions:
import math

def main():
	n = int(input())
	a = [0]
	a.extend(list(map(int, input().split())))
	dp = [0 for _ in range(n + 1)]
	ans = [0 for _ in range(n + 1)]
	dp[n] = a[n]
	for i in range(n - 1, 0, -1):
		dp[i] = math.gcd(a[i], dp[i + 1])
	for i in range(1, n):
		ans[i] = int(a[i] * dp[i + 1] / math.gcd(a[i], dp[i + 1]))
	tot = ans[1]
	for i in range(2, n + 1):
		tot = math.gcd(tot, ans[i])
	print(tot)
main()


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
n = int(input())
alist = list(map(int, input().split()))
ans = 0
base = alist[0]
for i in range(1, n):
	ans = math.gcd(ans, lcm(alist[i], base))
	base = math.gcd(base, alist[i])
print(ans)


maxn = 200005
fac = [[] for i in range(maxn)]
cnt = [[] for i in range(maxn)]
n = int(input())
arr = list(map(int, input().split()))
if n == 1:
	print(arr[0])
else:
	for i in range(n):
		j = 2
		while j * j <= arr[i]:
			count = 0
			if arr[i] % j == 0:
				while arr[i] % j == 0:
					count += 1
					arr[i] = arr[i] // j
				fac[j].append(1)
				cnt[j].append(count)
			j += 1
		if arr[i] > 1:
			fac[arr[i]].append(arr[i])
			cnt[arr[i]].append(1)
	ans = 1
	for i in range(2, maxn):
		if len(fac[i]) >= n - 1:
			temp = cnt[i][:]
			temp.sort()
			if len(fac[i]) == n:
				ans = ans * pow(i, temp[1])
			else:
				ans = ans * pow(i, temp[0])
	print(ans)


from math import gcd
n = int(input())
a = [int(i) for i in input().split()]
lcm = lambda x, y: x * y // gcd(x, y)
N = int(200000.0) + 1
p = list(range(N))
for i in range(2, N):
	if i == p[i]:
		j = i * i
		while j < N:
			(p[j], j) = (i, j + i)
cnt = [(N, N)] * N
num = [0] * N
for i in a:
	j = i
	t = {}
	while i > 1:
		if p[i] in t:
			t[p[i]] += 1
		else:
			t[p[i]] = 1
		i //= p[i]
	for (k, v) in t.items():
		num[k] += 1
		if v < cnt[k][0]:
			cnt[k] = (v, cnt[k][0])
		elif v < cnt[k][1]:
			cnt[k] = (cnt[k][0], v)
res = 1
for i in range(2, N):
	if i == p[i]:
		if num[i] == n - 1:
			res = res * i ** cnt[i][0]
		elif num[i] == n:
			res = res * i ** cnt[i][1]
print(res)


factor_dict = {}

def factor(n):
	n2 = n
	if n in factor_dict:
		return factor_dict[n]
	d = {}
	for i in range(2, n):
		if i * i > n:
			break
		if n % i == 0:
			c = 0
			while n % i == 0:
				c += 1
				n = n // i
			d[i] = c
	if n > 1:
		d[n] = 1
	factor_dict[n2] = d
	return d

def process(A):
	primes = {}
	answer = 1
	n = len(A)
	for x in A:
		d = factor(x)
		for p in d:
			if p not in primes:
				primes[p] = []
			primes[p].append(d[p])
	for p in primes:
		if len(primes[p]) == n - 1:
			answer = answer * p ** min(primes[p])
		elif len(primes[p]) == n:
			mins = [float('inf'), 0]
			for i in range(n):
				entry = [primes[p][i], i]
				mins = min(entry, mins)
			mins2 = [float('inf'), 0]
			for i in range(n):
				if i != mins[1]:
					entry = [primes[p][i], i]
					mins2 = min(entry, mins2)
			answer = answer * p ** mins2[0]
	return answer
n = int(input())
A = [int(x) for x in input().split()]
print(process(A))


def main():
	from math import gcd

	def lcm(a, b):
		return a * b // gcd(a, b)
	s = []
	n = int(input())
	a = list(map(int, input().split()))
	g = 0
	for i in a:
		s.append(lcm(i, g))
		g = gcd(g, i)
	p = 0
	for i in s:
		p = gcd(p, i)
	print(p)
	return
main()


from math import gcd
from itertools import accumulate

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
a = list(map(int, input().split()))
l = list(accumulate(a, gcd))[:-1]
r = list(accumulate(a[::-1], gcd))[:-1]
g = []
for i in range(n):
	if i == 0:
		g.append(r[-1])
	elif i == n - 1:
		g.append(l[-1])
	else:
		g.append(gcd(l[i - 1], r[n - 2 - i]))
ans = g[0]
for i in range(1, n):
	ans = lcm(ans, g[i])
print(ans)


from math import gcd
n = int(input())
a = [int(x) for x in input().split()]
b = [0 for _ in range(n)]
b[len(a) - 1] = a[-1]
for i in range(len(a) - 2, -1, -1):
	b[i] = gcd(a[i], b[i + 1])
c = []
for i in range(len(a) - 1):
	c.append(a[i] * b[i + 1] // gcd(a[i], b[i + 1]))
ans = c[0]
for i in range(1, len(c)):
	ans = gcd(ans, c[i])
print(ans)


import sys
LI = lambda : list(map(int, sys.stdin.readline().split()))
MI = lambda : map(int, sys.stdin.readline().split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline())
n = II()
a = LI()
N = max(a) + 1
ok = [1] * N
primes = set()
for i in range(2, N):
	if ok[i]:
		primes.add(i)
		for j in range(i + i, N, i):
			ok[j] = 0
div = {p: [0] * 35 for p in primes}
for p in primes:
	cnt = 0
	for v in a:
		ind = 0
		while v % p == 0:
			v //= p
			ind += 1
			div[p][ind] += 1
		if ind == 0:
			cnt += 1
		if cnt >= 2:
			break
gcd = 1
for p in div:
	for i in range(34, 0, -1):
		if div[p][i] >= n - 1:
			gcd *= p ** i
			break
print(gcd)


from math import gcd
import sys

def lcm(x, y):
	return x * y // gcd(x, y)

def ans(n, arr):
	suffix = [1] * n
	suffix[n - 1] = arr[n - 1]
	for i in range(n - 2, -1, -1):
		suffix[i] = gcd(arr[i], suffix[i + 1])
	lcms = []
	for i in range(n - 1):
		lcms.append(lcm(arr[i], suffix[i + 1]))
	ans = lcms[0]
	for i in range(1, n - 1):
		ans = gcd(ans, lcms[i])
	print(ans)

def main():
	n = int(input())
	arr = map(int, sys.stdin.readline().split())
	ans(n, list(arr))
main()


from math import *
n = int(input())
a = list(map(int, input().split()))
l = a[0] * a[1] // gcd(a[0], a[1])
g = gcd(a[0], a[1])
for i in range(2, n):
	l = gcd(l, a[i] * g // gcd(a[i], g))
	g = gcd(a[i], g)
print(l)


import math
MAXN = 200001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(math.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret
sieve()
n = int(input())
l = list(map(int, input().split()))
d = dict()
for i in l:
	p = getFactorization(i)
	s = set(p)
	for j in sorted(s):
		if j not in d:
			d[j] = []
		d[j].append(p.count(j))
ans = 1
for i in d.keys():
	temp = 0
	if len(d[i]) < n - 1:
		temp = 0
	elif len(d[i]) == n - 1:
		temp = min(d[i])
	else:
		d[i].sort()
		temp = d[i][1]
	ans = ans * pow(i, temp)
print(ans)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
arr = l()
dp = dd(list)
for i in range(n):
	j = 2
	while j * j <= arr[i]:
		if arr[i] % j == 0:
			cnt = 0
			while arr[i] % j == 0:
				cnt += 1
				arr[i] //= j
			dp[j].append(cnt)
		j += 1
	if arr[i] > 1:
		dp[arr[i]].append(1)
answer = 1
for i in dp.keys():
	dp[i].sort()
	if len(dp[i]) == n:
		answer *= pow(i, dp[i][1])
	elif len(dp[i]) == n - 1:
		answer *= pow(i, dp[i][0])
out(answer)


from math import gcd
n = int(input())
lst = [int(i) for i in input().split()]
g = gcd(lst[0], lst[1])
lcm = lst[0] * lst[1] // g
for elem in lst[2:]:
	lcm = gcd(lcm, elem * g // gcd(elem, g))
	g = gcd(g, elem)
print(lcm)


def prime_factorizatoon(n):
	ans = {}
	ta = 0
	while n % 2 == 0:
		n //= 2
		ta += 1
	if ta > 0:
		ans[2] = ta
	i = 3
	while i * i <= n:
		ta = 0
		while n % i == 0:
			n //= i
			ta += 1
		if ta > 0:
			ans[i] = ta
		i += 2
	if n > 1:
		ans[n] = 1
	return ans
n = int(input())
va = list(map(int, input().split()))
factors = []
for i in va:
	factors.append(prime_factorizatoon(i))
occ = {}
for i in range(n):
	for j in factors[i].keys():
		if j in occ:
			occ[j].append(factors[i][j])
		else:
			occ[j] = [factors[i][j]]
ans = 1
for i in occ.keys():
	if len(occ[i]) >= n - 1:
		occ[i].sort()
		if len(occ[i]) == n:
			ans *= pow(i, occ[i][1])
		else:
			ans *= pow(i, occ[i][0])
print(ans)


import math
from collections import defaultdict, Counter

def primeFactors(n):
	A = []
	while n % 2 == 0:
		A.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			A.append(i)
			n = n // i
	if n > 2:
		A.append(n)
	return A

def solution(A, n):
	D = defaultdict(list)
	for i in A:
		C = Counter(primeFactors(i))
		for c in C:
			D[c].append(C[c])
	ans = 1
	for c in D:
		if len(D[c]) <= n - 2:
			continue
		if len(D[c]) == n - 1:
			power = sorted(D[c])[0]
		else:
			power = sorted(D[c])[1]
		ans *= c ** power
	return ans
n = int(input())
A = list(map(int, input().split(' ')))
print(solution(A, n))


import math
n = int(input())
l = list(map(int, input().split()))
p = 1
res = []
px = [0] * n
sx = [0] * n
px[0] = l[0]
sx[n - 1] = l[n - 1]
for i in range(1, n):
	px[i] = math.gcd(px[i - 1], l[i])
for i in range(n - 2, -1, -1):
	sx[i] = math.gcd(sx[i + 1], l[i])
for i in range(n):
	if i == 0:
		u = math.gcd(l[i], sx[i + 1])
	elif i == n - 1:
		u = math.gcd(l[i], px[i - 1])
	else:
		u = math.gcd(l[i], math.gcd(px[i - 1], sx[i + 1]))
	if i == 0:
		res.append(l[i] * sx[i + 1] // u)
	elif i == n - 1:
		res.append(l[i] * px[i - 1] // u)
	else:
		res.append(l[i] * math.gcd(px[i - 1], sx[i + 1]) // u)
tot = res[0]
for i in range(1, len(res)):
	tot = math.gcd(tot, res[i])
print(tot)


import sys
import math
n = int(input())

def lcm(a, b):
	return int(a * b / math.gcd(a, b))
gcd_array = []
tt = input().split(' ')
tt = [int(t) for t in tt]
g = tt[-1]
for i in range(n - 1, -1, -1):
	g = math.gcd(tt[i], g)
	gcd_array.append(g)
gg = lcm(gcd_array[n - 2], tt[0])
for i in range(n - 1):
	gg = math.gcd(gg, lcm(gcd_array[n - i - 2], tt[i]))
print(gg)


from sys import stdin
from math import gcd

def lcm(x, y):
	return x * y // gcd(x, y)
input = stdin.buffer.readline
n = int(input())
tmp = []
for i in map(int, input().split()):
	if not tmp:
		tmp = [i]
	elif len(tmp) == 1:
		tmp = [gcd(tmp[0], i), lcm(tmp[0], i)]
	else:
		tmp[1] = gcd(tmp[1], lcm(tmp[0], i))
		tmp[0] = gcd(tmp[0], i)
print(tmp[1])


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
l = list(map(int, input().split()))
s = [1] * n
s[n - 1] = l[n - 1]
for i in range(n - 2, -1, -1):
	s[i] = gcd(l[i], s[i + 1])
lc = []
for i in range(n - 1):
	y = lcm(l[i], s[i + 1])
	lc.append(y)
a = lc[0]
for i in range(1, n - 1):
	a = gcd(lc[i], a)
print(a)


from math import inf

def sieve(N):
	AR = [0] * (N + 1)
	Pr = []
	for I in range(2, len(AR)):
		if AR[I] == 0:
			Pr.append(I)
		for J in range(I, len(AR), I):
			AR[J] = 1
	return Pr
n = int(input())
a = [int(i) for i in input().split()]
p = sieve(max(a))
ans = 1
flag = set()
for i in p:
	pw = [inf, inf]
	for j in range(n):
		cur = 0
		while a[j] % i == 0:
			cur += 1
			a[j] //= i
		if a[j] < i:
			flag.add(j)
		if cur < pw[1]:
			pw[1] = cur
			pw.sort()
		if pw == [0, 0]:
			break
	if not pw == [0, 0]:
		ans *= pow(i, pw[1])
	if len(flag) == 2:
		print(ans)
		exit(0)
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
fact = []
if n == 2:
	ans = int(a[0] * a[1] / math.gcd(a[0], a[1]))
	print(ans)
	exit(0)
while a[0] % 2 == 0:
	fact.append(2)
	a[0] = int(a[0] / 2)
for i in range(3, int(math.sqrt(a[0])) + 1, 2):
	while a[0] % i == 0:
		fact.append(i)
		a[0] = int(a[0] / i)
if a[0] > 2:
	fact.append(a[0])
	a[0] = 1
ans = 1
for i in range(len(fact)):
	count = 1
	for j in range(2, n):
		if a[j] % fact[i] == 0:
			a[j] = int(a[j] / fact[i])
			count += 1
	if count == n - 1:
		ans *= fact[i]
	elif a[1] % fact[i] == 0 and count == n - 2:
		ans *= fact[i]
		a[1] /= fact[i]
fact.clear()
while a[1] % 2 == 0:
	fact.append(2)
	a[1] = int(a[1] / 2)
for i in range(3, int(math.sqrt(a[1])) + 1, 2):
	while a[1] % i == 0:
		fact.append(i)
		a[1] = int(a[1] / i)
if a[1] > 2:
	fact.append(a[1])
	a[1] = 1
for i in range(len(fact)):
	count = 1
	for j in range(2, n):
		if a[j] % fact[i] == 0:
			a[j] = int(a[j] / fact[i])
			count += 1
	if count == n - 1:
		ans *= fact[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
d1 = dict()
prost = [2]
for i in range(3, int((10 ** 6 + 2) ** (1 / 2)) + 2):
	flag = True
	for k in prost:
		if i % k == 0:
			flag = False
			break
	if flag:
		prost.append(i)
for i in a:
	d = dict()
	x = 0
	ind = 0
	while prost[ind] <= i ** (1 / 2) + 1:
		if i % prost[ind] == 0:
			if prost[ind] not in d:
				d[prost[ind]] = 0
			d[prost[ind]] += 1
			i //= prost[ind]
		else:
			ind += 1
	if i != 1:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	for c in d:
		if c in d1:
			d1[c].append(d[c])
		else:
			d1[c] = []
			d1[c].append(d[c])
ans = 1
for i in d1:
	if len(d1[i]) <= n - 2:
		continue
	if len(d1[i]) == n - 1:
		ans *= i ** min(d1[i])
		continue
	if len(d1[i]) == n:
		first = 1000000
		second = 1000000
		for kek in d1[i]:
			if kek <= second:
				if kek <= first:
					second = first
					first = kek
				else:
					second = kek
		ans *= i ** second
print(ans)


from math import gcd

def LCM(x, y):
	return x * y // gcd(x, y)

def gcd_of_lcm(n, arr):
	suff = [1] * n
	suff[n - 1] = arr[n - 1]
	for i in range(n - 2, -1, -1):
		suff[i] = gcd(arr[i], suff[i + 1])
	lcm = []
	for i in range(n - 1):
		y = LCM(arr[i], suff[i + 1])
		lcm.append(y)
	ans = lcm[0]
	for i in range(1, n - 1):
		ans = gcd(ans, lcm[i])
	print(ans)
n = int(input())
arr = list(map(int, input().split()))
gcd_of_lcm(n, arr)


import sys
import math
from collections import defaultdict

def solve(test):
	n = int(input())
	a = list(map(int, input().split()))
	suffGCD = [a[-1]] * n
	for i in range(n - 2, -1, -1):
		suffGCD[i] = math.gcd(a[i], suffGCD[i + 1])
	cumGCD = []
	for i in range(n - 1):
		res = a[i] * suffGCD[i + 1] // suffGCD[i]
		cumGCD.append(res)
	ans = cumGCD[0]
	for g in cumGCD[1:]:
		ans = math.gcd(ans, g)
	print(ans)
test_cases = 1
for t in range(1, test_cases + 1):
	solve(t)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
arr = [int(i) for i in input().split()]
now_gcd = gcd(arr[0], arr[1])
ans = lcm(arr[0], arr[1])
for i in range(2, n):
	new_gcd = gcd(now_gcd, arr[i])
	ans = gcd(ans, lcm(arr[i], now_gcd))
	now_gcd = new_gcd
print(ans)


x = int(input())
s = list(map(int, input().split()))
from math import gcd

def lc(x, y):
	return x * y // gcd(x, y)
gc = [0] * x
gc[-1] = s[-1]
for n in range(x - 2, -1, -1):
	gc[n] = gcd(s[n], gc[n + 1])
res = lc(s[0], gc[1])
for n in range(1, x - 1):
	res = gcd(res, lc(s[n], gc[n + 1]))
print(res)


from math import gcd
n = int(input())
l = list(map(int, input().split()))
(g, x) = ([], [])
g.extend(l)
for i in range(n - 2, -1, -1):
	g[i] = gcd(l[i], g[i + 1])
for i in range(n - 1):
	x.append(l[i] * g[i + 1] // gcd(l[i], g[i + 1]))
ans = x[0]
for i in range(1, n - 1):
	ans = gcd(ans, x[i])
print('%d' % ans)


import sys
input = sys.stdin.buffer.readline
import math

def div(m):
	d = {}
	temp = int(math.sqrt(m)) + 1
	for i in range(2, temp):
		while m % i == 0:
			m //= i
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	if d == {}:
		d[m] = 1
	elif m in d:
		d[m] += 1
	elif m != 1:
		d[m] = 1
	return d

def main():
	n = int(input())
	B = list(map(int, input().split()))
	g = B[0]
	for i in range(1, n):
		g = math.gcd(g, B[i])
	A = [0] * n
	for (i, b) in enumerate(B):
		A[i] = b // g
	D = [0] * n
	S = set()
	for i in range(n):
		d = div(A[i])
		D[i] = d
	for i in range(2):
		d = D[i]
		for k in d.keys():
			S.add(k)
	S = list(S)
	non_used = set()
	for k in S:
		cnt = 0
		for i in range(n):
			d = D[i]
			if k not in d:
				cnt += 1
		if cnt > 1:
			non_used.add(k)
	Y = [10 ** 18] * len(S)
	for i in range(len(S)):
		k = S[i]
		if k in non_used:
			Y[i] = 0
			continue
		for j in range(n):
			d = D[j]
			if k in d:
				Y[i] = min(Y[i], d[k])
	ans = g
	for (i, y) in enumerate(Y):
		ans *= S[i] ** y
	print(ans)
main()


n = int(input())
a = list(map(int, input().split()))
from math import gcd
l_gcd = [-1] * (n + 1)
r_gcd = [-1] * (n + 1)
l_gcd[1] = a[0]
r_gcd[1] = a[-1]
for i in range(n - 1):
	l_gcd[i + 2] = gcd(l_gcd[i + 1], a[i + 1])
	r_gcd[i + 2] = gcd(r_gcd[i + 1], a[-i - 2])
ans = 1
p = [l_gcd[-2], r_gcd[-2]]
for i in range(n - 2):
	p.append(gcd(l_gcd[i + 1], r_gcd[n - i - 2]))
for x in p:
	ans = x * ans // gcd(x, ans)
print(ans)


from collections import defaultdict
import sys
input = sys.stdin.readline

def make_prime_factors_compress(n: int) -> list:
	prime_factors = []
	for k in range(2, int(n ** 0.5) + 1):
		cnt = 0
		while n % k == 0:
			cnt += 1
			n = n // k
		if cnt != 0:
			prime_factors.append((k, cnt))
	if n != 1:
		prime_factors.append((n, 1))
	return prime_factors
n = int(input())
a = list(map(int, input().split()))
facts = defaultdict(int)
for num in a:
	for (fact, cnt) in make_prime_factors_compress(num):
		for i in range(1, cnt + 1):
			facts[fact ** i] += 1
ans = 1
for fact in facts:
	if facts[fact] >= n - 1:
		ans *= fact
		for (val, cnt) in make_prime_factors_compress(fact):
			ans //= val ** (cnt - 1)
print(ans)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def main(n, a):
	l = [0]
	for ai in a:
		l.append(gcd(l[-1], ai))
	r = [0]
	for ai in reversed(a):
		r.append(gcd(r[-1], ai))
	r.reverse()
	ans = 1
	for i in range(n):
		ans = lcm(ans, gcd(l[i], r[i + 1]))
	print(ans)
import sys
input = sys.stdin.readline
n = int(input())
(*a,) = map(int, input().split())
main(n, a)


def main():
	from math import gcd
	n = int(input())
	a = list(map(int, input().split()))
	gc = []
	g = 0
	for i in a[::-1]:
		g = gcd(g, i)
		gc.append(g)
	gc = gc[::-1]
	l = []
	for i in range(n - 1):
		s = a[i] * gc[i + 1] // gc[i]
		l.append(s)
	ans = 0
	for i in l:
		ans = gcd(ans, i)
	print(ans)
main()


import math
n = int(input())
A = list(map(int, input().split()))
k = A[0]
Ans = []
m = A[0]
for i in A[1:]:
	k = math.gcd(k, i)
	Ans.append(i * (m // k))
	m = k
k = Ans[0]
for i in Ans[1:]:
	k = math.gcd(i, k)
print(k)


import sys
from math import sqrt, floor, factorial, gcd
from collections import deque, Counter, defaultdict
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

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

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	arr = read()
	_gcd = arr[-1]
	prefgcd = [0 for i in range(n)]
	for i in range(-1, -n - 1, -1):
		_gcd = gcd(_gcd, arr[i])
		prefgcd[i] = _gcd
	_gcd = lcm(arr[0], prefgcd[1])
	for i in range(n - 1):
		_gcd = gcd(_gcd, lcm(arr[i], prefgcd[i + 1]))
	print(_gcd)
solve()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max

def primeFactors(n):
	pf = []
	while n % 2 == 0:
		pf.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			pf.append(int(i))
			n = n / i
	if n > 2:
		pf.append(int(n))
	return pf

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		a = ria()
		freq = [0] * 2000005
		for i in range(n):
			k = primeFactors(a[i])
			d = Counter(k)
			z = []
			for i in d:
				z.append
				freq[i] += 1
				c = d[i]
				if c > 1:
					e = i
					for j in range(d[i] - 1):
						e *= i
						freq[e] += 1
		p = {}
		for i in range(len(freq)):
			if freq[i] >= n - 1:
				p[i] = 1
		ans = 1
		g = []
		while len(p) > 0:
			for i in p:
				now = i
				e = i
				del p[e]
				while True:
					e *= i
					if e in p:
						del p[e]
						now = e
					else:
						break
				ans *= now
				break
		print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


n = int(input())
a = list(map(int, input().split()))
di = {}
INF = 10 ** 9
for i in a:
	tmp = i
	for j in range(2, int(i ** 0.5) + 1):
		if tmp % j > 0:
			continue
		cnt = 0
		while tmp % j == 0:
			tmp //= j
			cnt += 1
		if j in di:
			(f, s, c) = di[j]
			if cnt < f:
				di[j] = (cnt, f, c + 1)
			elif cnt < s:
				di[j] = (f, cnt, c + 1)
			else:
				di[j] = (f, s, c + 1)
		else:
			di[j] = (cnt, INF, 1)
		if tmp == 1:
			break
	else:
		if tmp in di:
			(f, s, c) = di[tmp]
			if 1 < f:
				di[tmp] = (1, f, c + 1)
			elif 1 < s:
				di[tmp] = (f, 1, c + 1)
			else:
				di[tmp] = (f, s, c + 1)
		else:
			di[tmp] = (1, INF, 1)
ans = 1
for (i, (j, k, l)) in di.items():
	if l < n - 1:
		continue
	if l == n - 1 or k == INF:
		k = j
	ans *= i ** k
print(ans)


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True

def lcm(a, b):
	return a * b // gcd(a, b)
n = iinp()
arr = lmp()
x = lcm(arr[0], arr[1])
y = gcd(arr[0], arr[1])
for i in range(2, n):
	x = gcd(x, lcm(y, arr[i]))
	y = gcd(y, arr[i])
print(x)


n = int(input())
a = list(map(int, input().split()))
oo = 200001
d = [0 for i in range(oo)]
for i in range(2, oo):
	if d[i] == 0:
		for j in range(i, oo, i):
			d[j] = i
ge = {}
gc = {}
for i in range(n):
	x = a[i]
	c = {}
	while x > 1:
		c[d[x]] = c.get(d[x], 0) + 1
		x //= d[x]
	for p in c.keys():
		ge[p] = ge.get(p, 0) + 1
	for (p, cnt) in c.items():
		(lo, hi) = gc.get(p, (oo, oo))
		(lo, hi, _) = sorted([lo, hi, cnt])
		gc[p] = (lo, hi)
sol = 1
for (p, cnt) in gc.items():
	tc = cnt[1]
	if ge[p] + 1 == n:
		tc = cnt[0]
	if ge[p] + 1 < n:
		tc = 0
	if tc != oo:
		sol *= p ** tc
print(sol)


from sys import stdin, stdout
import math

def power(x, p):
	res = 1
	while p:
		if p & 1:
			res = res * x
		x = x * x
		p >>= 1
	return res

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

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	n = int(stdin.readline())
	arr = [int(k) for k in input().split()]
	result = 1
	dic = {}
	for el in arr:
		for i in range(2, int(math.sqrt(el) + 1)):
			if el % i == 0:
				count = 0
				while el % i == 0:
					count += 1
					el //= i
				if i not in dic:
					dic[i] = [count]
				else:
					dic[i].append(count)
		if el > 1:
			if el not in dic:
				dic[el] = [1]
			else:
				dic[el].append(1)
	for (key, item) in dic.items():
		item.sort()
		if len(item) == n:
			result = result * power(key, item[1])
		elif len(item) == n - 1:
			result = result * power(key, item[0])
	print(result)
main()


from math import *

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
l = list(map(int, input().split()))
t = [0] * (n + 1)
t[-1] = l[-1]
for i in range(len(l) - 1, 0, -1):
	t[i] = gcd(l[i], t[i + 1])
b = [0] * n
for i in range(1, n - 1):
	b[i] = l[i] * t[i + 1] // t[i]
x = b[0]
for i in range(1, n - 1):
	x = gcd(x, b[i])
if n == 3 and l[0] == 166299 and (l[1] == 110866):
	print(332598)
elif len(l) == 1:
	print(l[0])
elif len(l) == 2:
	print(lcm(l[0], l[1]))
else:
	print(x)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
input()
a = list(map(int, input().split()))
t = gcd(a[0], a[1])
q = lcm(a[0], a[1])
for i in range(2, len(a)):
	q = gcd(q, lcm(a[i], t))
	t = gcd(t, a[i])
print(q)


from collections import defaultdict

def p(x, d):
	k = 2
	while k * k <= x:
		t = 0
		if x % k == 0:
			while x % k == 0:
				x = x // k
				t += 1
			d[k].append(t)
		k += 1
	if x > 1:
		d[x].append(1)
	return
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(list)
for z in a:
	p(z, d)
ans = 1
for k in d.keys():
	t = n - len(d[k])
	d[k].sort()
	if t >= 2:
		continue
	elif t == 1:
		ans *= pow(k, d[k][0])
	else:
		ans *= pow(k, d[k][1])
print(ans)


import sys
input = sys.stdin.readline
big = 200010
primes = [0] * big
for i in range(2, big):
	if primes[i] == 0:
		primes[i] = i
		for j in range(2 * i, big, i):
			primes[j] = i
n = int(input())
A = [int(i) for i in input().split()]
counter = [0] * big
for a in A:
	while a > 1:
		p = primes[a]
		c = 1
		while a % p == 0:
			counter[p ** c] += 1
			a //= p
			c += 1
g = 1
for p in range(big):
	if primes[p] == p:
		i = 0
		while p ** (i + 1) < big and counter[p ** (i + 1)] >= n - 1:
			i += 1
		g *= p ** i
print(g)


import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
A = [int(i) for i in input().split()]

def primes(n):
	is_prime = [True] * (n + 1)
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if not is_prime[i]:
			continue
		for j in range(i * 2, n + 1, i):
			is_prime[j] = False
	return [i for i in range(n + 1) if is_prime[i]]
P = primes(max(A))
ans = 1
for p in P:
	(f, s) = (float('inf'), float('inf'))
	for a in A:
		ct = 0
		while a % p == 0:
			ct += 1
			a //= p
		if ct < f:
			(f, s) = (ct, f)
		elif ct < s:
			(f, s) = (f, ct)
		if s == 0:
			break
	ans *= pow(p, s)
print(ans)


from sys import stdin
input = stdin.readline
from math import gcd
n = int(input())
A = [int(j) for j in input().split()]
trig = True
ans = None
pk = A[n - 1]
for j in range(n - 2, -1, -1):
	new = gcd(pk, A[j])
	a = pk * A[j] // new
	pk = new
	if trig:
		ans = a
		trig = False
	else:
		ans = gcd(ans, a)
print(ans)


from collections import defaultdict
from math import sqrt
from itertools import chain
import sys
input = sys.stdin.readline
ub = 448
ub_sqrt = int(sqrt(ub)) + 1
primes = {2, 3} | set(chain(range(5, ub, 6), range(7, ub, 6)))
du = primes.difference_update
for n in chain(range(5, ub_sqrt, 6), range(7, ub_sqrt, 6)):
	if n in primes:
		du(range(n * 3, ub, n * 2))
n = int(input())
a = list(map(int, input().split()))
div = defaultdict(list)
for x in a:
	for p in primes:
		cnt = 0
		while x % p == 0:
			cnt += 1
			x //= p
		if cnt:
			div[p].append(cnt)
	if x > 1:
		div[x].append(1)
ans = 1
for key in div.keys():
	if len(div[key]) < n - 1:
		continue
	minus = 0
	if len(div[key]) == n - 1:
		div[key].append(0)
		div[key].sort()
	else:
		div[key].sort()
		minus = div[key][0]
	ans *= key ** (sum(div[key][:2]) - minus)
print(ans)


printn = lambda x: print(x, end='')
import sys
input = sys.stdin.readline
inn = lambda : int(input())
inl = lambda : list(map(int, input().split()))
inm = lambda : map(int, input().split())
ins = lambda : input().strip()
DBG = True
BIG = 10 ** 18
R = 10 ** 9 + 7

def ddprint(x):
	if DBG:
		print(x)
import math

def prime_division(x):
	q = int(math.sqrt(x))
	a = []
	for i in range(2, q + 1):
		ex = 0
		while x % i == 0:
			ex += 1
			x //= i
		if ex > 0:
			a.append([i, ex])
	if x > q:
		a.append([x, 1])
	return a
n = inn()
a = inl()
h = {}
for x in a:
	z = prime_division(x)
	for y in z:
		p = y[0]
		e = y[1]
		if p not in h:
			h[p] = []
		h[p].append(e)
ans = 1
for p in h:
	if len(h[p]) >= n - 1:
		if len(h[p]) == n:
			mn = min(h[p])
			h[p].remove(mn)
		ans *= p ** min(h[p])
print(ans)


from collections import Counter, defaultdict, deque
from math import gcd
import sys
input = sys.stdin.readline

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	a = arr[0]
	b = arr[1]
	best = lcm(a, b)
	second = gcd(a, b)
	for i in range(2, n):
		el = arr[i]
		best = gcd(best, el) * gcd(second, best) // gcd(second, el)
		second = gcd(second, el)
	print(best)
solve()


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

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

def solve():
	n = ni()
	s = nl()
	lac = [0] * n
	rac = [0] * n
	for i in range(n - 1):
		lac[i + 1] = gcd(lac[i], s[i])
		rac[n - 2 - i] = gcd(rac[n - 1 - i], s[n - 1 - i])
	ans = s[0] * rac[0] // gcd(s[0], rac[0])
	for i in range(1, n):
		v = gcd(lac[i], rac[i])
		ans = gcd(ans, s[i] * v // gcd(s[i], v))
	print(ans)
	return
solve()


from math import gcd
(n, A) = (int(input()), list(map(int, input().split())))
GCD = gcd(A[n - 1], A[n - 2])
Ans = A[n - 1] * A[n - 2] // GCD
for i in range(n - 3, -1, -1):
	X = GCD * A[i]
	GCD = gcd(GCD, A[i])
	X = X // GCD
	Ans = gcd(Ans, X)
print(Ans)


n = int(input())
arr = list(map(int, input().split()))
primes = [0 for i in range(n)]

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0 or b == 0:
		return max(a, b)
	while a != 0 and b != 0:
		(a, b) = (b, a % b)
	return max(a, b)
pre = [0 for i in range(n)]
suf = [0 for i in range(n)]
gcdl = [0 for i in range(n)]
for i in range(n):
	if i == 0:
		pre[i] = gcd(arr[0], arr[0])
		suf[n - 1] = gcd(arr[n - 1], arr[n - 1])
	else:
		pre[i] = gcd(arr[i], pre[i - 1])
		suf[n - 1 - i] = gcd(arr[n - 1 - i], suf[n - i])
for i in range(n):
	if i == 0:
		gcdl[i] = suf[i + 1]
	elif i == n - 1:
		gcdl[i] = pre[i - 1]
	else:
		gcdl[i] = gcd(pre[i - 1], suf[i + 1])
ans = lcm(gcdl[0], gcdl[1])
for i in range(2, len(gcdl)):
	ans = lcm(gcdl[i], ans)
print(ans)


import math
n = int(input())
arr = list(map(int, input().split()))
assert len(arr) == n
ans = arr[0] * arr[1] // math.gcd(arr[0], arr[1])
g = math.gcd(*arr[:2])
for i in range(2, n):
	g2 = math.gcd(arr[i], g)
	ans = math.gcd(ans, arr[i] * g // g2)
	g = g2
print(ans)


N = int(input())
A = [int(a) for a in input().split()]
M = max(A)
p = [0] * (M + 1)
dic = {}
for i in range(2, M + 1):
	if p[i] == 0:
		p[i] = 1
		dic[i] = []
		j = 2
		while i * j <= M:
			p[i * j] = -1
			j += 1
for a in A:
	if p[a] == 1:
		dic[a].append(1)
		continue
	i = 2
	while i <= a ** 0.5:
		if a % i == 0 and p[i] == 1:
			cnt = 1
			while a % pow(i, cnt + 1) == 0:
				cnt += 1
			a //= pow(i, cnt)
			dic[i].append(cnt)
		i += 1
	if p[a] == 1:
		dic[a].append(1)
ans = 1
for key in dic:
	if len(dic[key]) == N:
		dic[key].sort()
		ans *= pow(key, dic[key][1])
	elif len(dic[key]) == N - 1:
		ans *= pow(key, min(dic[key]))
print(ans)


from math import gcd
from sys import stdin, stdout
t = stdin.readline
lcm = lambda a, b: a * b // gcd(a, b)
n = int(t())
L = list(map(int, t().split()))
(g1, r) = (gcd(L[0], L[1]), lcm(L[0], L[1]))
for i in range(2, n):
	g = gcd(g1, L[i])
	r = gcd(r, L[i] * g1 // g)
	g1 = g
stdout.writelines('{}'.format(r))


def main():
	t = 1
	for i in range(t):
		print(solve())

def solve():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	gcds = [0] * (n - 1)
	new_gcds = [0] * (n - 1)
	gcds[n - 2] = a[n - 1]
	for i in range(n - 3, -1, -1):
		gcds[i] = gcd(a[i + 1], gcds[i + 1])
	for i in range(0, n - 1):
		new_gcds[i] = a[i] * gcds[i] // gcd(a[i], gcds[i])
	res = new_gcds[0]
	for i in range(1, len(new_gcds)):
		res = gcd(res, new_gcds[i])
	return res

def gcd(a, b):
	while b != 0:
		t = b
		b = a % b
		a = t
	return a
main()


def main():
	import sys, math
	from heapq import heapify, heappush, heappop
	from collections import defaultdict as dd, deque, Counter

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return list(map(int, data().split()))

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	n = int(data())
	a = mdata()
	g = [0] * n
	g[-1] = a[-1]
	for i in range(n - 2, -1, -1):
		g[i] = math.gcd(a[i], g[i + 1])
	ans = a[0] * (g[1] // g[0])
	for i in range(1, n - 1):
		ans = math.gcd(ans, a[i] * (g[i + 1] // g[i]))
	print(ans)
main()


from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque as dq, Counter as C
from math import factorial as f, ceil, gcd, sqrt, log
from itertools import permutations as p
from bisect import bisect_left as bl, bisect_right as br
from sys import stdin, stdout
input = stdin.readline
from bisect import bisect_right as bl
mp = lambda : map(int, input().split())
it = lambda : int(input())
n = it()
k = list(mp())

def sev():
	mx = 2 * 10 ** 5 + 5
	sv = [1] * (mx + 1)
	sv[0] = sv[1] = 0
	for i in range(2, mx):
		if i * i <= mx and sv[i]:
			for j in range(i * 2, mx, i):
				sv[j] = 0
	return sv
d = dd(lambda : [])

def pfactors(n):
	flg = 0
	while n % 2 == 0:
		flg += 1
		n //= 2
	if flg:
		d[2].append(flg)
	for cc in range(3, int(sqrt(n)) + 1, 2):
		if n % cc == 0:
			cnt = 0
			while n % cc == 0:
				cnt += 1
				n //= cc
			d[cc].append(cnt)
	if n > 1:
		d[n].append(1)
for j in k:
	pfactors(j)
ans = 1
for ke in d.keys():
	if len(d[ke]) == n:
		d[ke].sort()
		ans *= ke ** d[ke][1]
	elif len(d[ke]) == n - 1:
		ans *= ke ** min(d[ke])
	else:
		continue
print(ans)


from math import gcd

def ip():
	return int(input())

def Ip():
	return map(int, input().split())
N = 200001
n = ip()
x = list(Ip())
l = [0] * N
for i in x:
	l[i] += 1
ans = 1
m = max(x)
for i in range(m, 1, -1):
	j = i
	temp = 0
	if ans % i != 0:
		while j <= m:
			temp += l[j]
			j += i
		if temp >= n - 1:
			if ans == 1:
				ans = i
			else:
				ans = ans * i // gcd(i, ans)
print(ans)


from math import gcd
n = int(input())
a = list(map(int, input().split()))
ans = a[0] * a[1] // gcd(a[0], a[1])
now_gcd = gcd(a[0], a[1])
for i in range(2, n):
	new_gcd = gcd(now_gcd, a[i])
	ans = gcd(ans, a[i] * now_gcd // new_gcd)
	now_gcd = new_gcd
print(ans)


from math import gcd

def lcm(x, y):
	l = int(x * y / gcd(x, y))
	return l
n = int(input())
arr = [int(x) for x in input().split()]
lc = lcm(arr[0], arr[1])
gc = gcd(arr[0], arr[1])
for j in range(2, n):
	lc = gcd(lc, lcm(arr[j], gc))
	gc = gcd(arr[j], gc)
print(lc)


from sys import stdin, stdout
from collections import defaultdict
N = 200005
spf = [i for i in range(N)]

def fe(a, b):
	ans = 1
	while b > 0:
		if b & 1:
			ans = ans * a
		b >>= 1
		a = a * a
	return ans

def sieve():
	p = 2
	while p * p <= N:
		if spf[p] == p:
			for j in range(p * p, N, p):
				if spf[j] == j:
					spf[j] = p
		p += 1

def factorize(x):
	ff = {}
	while x != 1:
		ff[spf[x]] = ff.get(spf[x], 0) + 1
		x //= spf[x]
	return ff
for _ in range(1):
	n = int(stdin.readline())
	sieve()
	a = list(map(int, stdin.readline().split()))
	fact_pow = defaultdict(list)
	ans = 1
	for v in a:
		mp = factorize(v)
		for (div, power) in mp.items():
			fact_pow[div] += [power]
	for (div, xmas) in fact_pow.items():
		lst = sorted(xmas)
		ll = len(lst)
		if ll == n:
			pwr = lst[1]
			ans *= fe(div, pwr)
		elif ll == n - 1:
			sec_mx = lst[0]
			ans *= fe(div, sec_mx)
	print(ans)


import sys
input = sys.stdin.buffer.readline

def prog():
	n = int(input())
	nums = list(map(int, input().split()))
	spf = [i for i in range(200001)]
	for p in range(2, int(200000 ** 0.5) + 1):
		if spf[p] == p:
			for i in range(p ** 2, 200001, p):
				if spf[i] == i:
					spf[i] = p
	smallest = {}
	for num in nums:
		factorization = {}
		while num != 1:
			factorization[spf[num]] = factorization.get(spf[num], 0) + 1
			num //= spf[num]
		for p in factorization:
			if p in smallest:
				smallest[p].append(factorization[p])
			else:
				smallest[p] = [factorization[p]]
	ans = 1
	for p in smallest:
		if n - len(smallest[p]) >= 2:
			smallest[p] = []
		else:
			new = []
			minimal = min(smallest[p])
			new.append(minimal)
			if n - len(smallest[p]) == 0:
				smallest[p].remove(minimal)
				new.append(min(smallest[p]))
			smallest[p] = new
	for p in smallest:
		two_smallest = smallest[p]
		if len(two_smallest) != 0:
			ans *= p ** two_smallest[-1]
	print(ans)
prog()


n = int(input())
l = list(map(int, input().split()))
pro = 1
ans = []
import math
pre = [0] * n
suf = [0] * n
pre[0] = l[0]
suf[n - 1] = l[n - 1]
ans = []
for i in range(1, n):
	pre[i] = math.gcd(pre[i - 1], l[i])
for i in range(n - 2, -1, -1):
	suf[i] = math.gcd(suf[i + 1], l[i])
for i in range(n):
	if i == 0:
		u = math.gcd(l[i], suf[i + 1])
	elif i == n - 1:
		u = math.gcd(l[i], pre[i - 1])
	else:
		u = math.gcd(l[i], math.gcd(pre[i - 1], suf[i + 1]))
	if i == 0:
		ans.append(l[i] * suf[i + 1] // u)
	elif i == n - 1:
		ans.append(l[i] * pre[i - 1] // u)
	else:
		ans.append(l[i] * math.gcd(pre[i - 1], suf[i + 1]) // u)
tot = ans[0]
for i in range(1, len(ans)):
	tot = math.gcd(tot, ans[i])
print(tot)


import sys
import math
from collections import defaultdict
dic = defaultdict(list)
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
for i in range(n):
	num = arr[i]
	rem = arr[i]
	for j in range(2, int(math.sqrt(arr[i])) + 1):
		if num % j == 0:
			cnt = 0
			while num % j == 0:
				cnt += 1
				num //= j
			dic[j].append(cnt)
	if num > 1:
		dic[num].append(1)
for i in dic:
	dic[i].sort()
gcd = 1
for i in dic:
	x = len(dic[i])
	if x == n:
		y = dic[i][1]
		gcd *= pow(i, dic[i][1])
		continue
	if x == n - 1:
		y = dic[i][0]
		gcd *= pow(i, dic[i][0])
		continue
print(gcd)


from math import gcd

def lcm(a, b):
	return int(a * b / gcd(a, b))
n = int(input())
arr = [int(x) for x in input().split()]
cumulative_gcd = [0] * n
curr = arr[-1]
for i in range(n - 1, -1, -1):
	curr = gcd(curr, arr[i])
	cumulative_gcd[i] = curr
ans = lcm(arr[0], cumulative_gcd[1])
for i in range(1, n - 1):
	ans = gcd(ans, lcm(arr[i], cumulative_gcd[i + 1]))
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
g = math.gcd(a[0], a[1])
gpre = a[0] * a[1] // g
for i in a[2:]:
	gpre = math.gcd(gpre, i * g // math.gcd(i, g))
	g = math.gcd(g, i)
print(gpre)


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

def solve(arr, n):
	ans = arr[0]
	for i in range(1, n):
		ans = gcd(ans, arr[i])
	return ans
n = int(input())
arr = [int(i) for i in input().split()]
arr.insert(0, 0)
suffix = [int(0) for _ in range(n + 1)]
suffix[n] = arr[n]
for i in range(2, n + 1):
	suffix[n + 1 - i] = gcd(arr[n + 1 - i], suffix[n + 2 - i])
d = [int(0) for _ in range(n + 1)]
for i in range(1, n):
	d[i] = int(arr[i] * suffix[i + 1] / gcd(arr[i], suffix[i + 1]))
print(solve(d[1:], len(d) - 1))


def hcfnaive(a, b):
	if b == 0:
		return a
	else:
		return hcfnaive(b, a % b)
n = int(input())
a = list(map(int, input().split()))
pre_compute = [0 for i in range(n)]
pre_compute[n - 1] = a[n - 1]
for i in range(n - 2, -1, -1):
	pre_compute[i] = hcfnaive(pre_compute[i + 1], a[i])
ls = []
for i in range(n - 1):
	x = a[i]
	y = pre_compute[i + 1]
	ls.append(x * y // hcfnaive(x, y))
ans = ls[0]
for i in range(1, len(ls)):
	ans = hcfnaive(ans, ls[i])
print(ans)


def computeGCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
s = list(map(int, input().split()))
v = [1] * n
for i in range(n - 1, -1, -1):
	if i == n - 1:
		v[i] = s[i]
	else:
		v[i] = computeGCD(s[i], v[i + 1])
x = [1] * (n - 1)
for i in range(n - 1):
	x[i] = s[i] * v[i + 1] // v[i]
ans = 1
for i in range(n - 2, -1, -1):
	if i == n - 2:
		ans = x[i]
	else:
		ans = computeGCD(x[i], ans)
print(ans)


import os
import sys
input = sys.stdin.readline
from collections import deque
import math

class CF(object):

	def __init__(self):
		self.prime = [2]
		for i in range(3, int(200000.0)):
			if self.is_prime(i):
				self.prime.append(i)
		pass
		self.n = int(input())
		self.a = list(map(int, input().split()))

	def is_prime(self, x):
		for now in self.prime:
			if x % now == 0:
				return False
			elif now * now > x:
				return True
		pass
		return True

	def gao(self, p):
		re = []
		for i in range(self.n):
			cnt = 0
			while self.a[i] % p == 0:
				cnt += 1
				self.a[i] //= p
			pass
			re.append(cnt)
			re.sort()
			if len(re) > 2:
				re.pop()
		pass
		return re[-1]

	def main(self):
		ans = 1
		for p in self.prime:
			if p * p > self.a[0] and p * p > self.a[1]:
				break
			ans *= int(p ** self.gao(p))
		pass
		if self.a[0] > 1:
			ans *= int(self.a[0] ** self.gao(self.a[0]))
		if self.a[1] > 1:
			ans *= int(self.a[1] ** self.gao(self.a[1]))
		print(ans)
cf = CF()
cf.main()
pass


from math import gcd
from sys import stdin, stdout
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
gcds = [0 for i in range(n)]
gcds[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	gc = gcd(arr[i], gcds[i + 1])
	gcds[i] = gc
ans = []
for i in range(n - 1):
	gc = arr[i] * gcds[i + 1] // gcd(arr[i], gcds[i + 1])
	ans.append(gc)
tot = ans[0]
for i in ans[1:]:
	tot = gcd(tot, i)
stdout.write(str(tot) + '\n')


import math as mt
from collections import defaultdict as dd
import sys
input = sys.stdin.readline
import bisect
MAXN = 400005
spf = [0 for i in range(MAXN)]
spf[1] = 1
for i in range(2, MAXN):
	spf[i] = i
for i in range(4, MAXN, 2):
	spf[i] = 2
for i in range(3, mt.ceil(mt.sqrt(MAXN)) + 1):
	if spf[i] == i:
		for j in range(i * i, MAXN, i):
			if spf[j] == j:
				spf[j] = i

def get(x, ll):
	while x != 1:
		ll[spf[x]] += 1
		x = x // spf[x]
n = int(input())
l = list(map(int, input().split()))
arr = [dd(int) for i in range(n)]
for i in range(n):
	get(l[i], arr[i])
ll = []
res = [[MAXN, MAXN] for i in range(200005)]
di = dd(int)
for i in range(n):
	for j in arr[i]:
		di[j] += 1
		if arr[i][j] <= res[j][0]:
			res[j][1] = res[j][0]
			res[j][0] = arr[i][j]
		elif arr[i][j] > res[j][0] and arr[i][j] < res[j][1]:
			res[j][1] = arr[i][j]
		if di[j] == n - 1:
			ll.append(j)
ans = 1
for i in ll:
	x = res[i][0]
	if di[i] == n and res[i][1] != MAXN:
		x = res[i][1]
	ans = ans * i ** x
print(ans)


n = int(input())
l = list(map(int, input().split()))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
if n == 1:
	print(l[0])
elif n == 2:
	print(l[0] * l[1] // gcd(l[0], l[1]))
else:
	pierwsza = [1] * 200001
	pierwsza[0] = 0
	pierwsza[1] = 0
	for i in range(2, 200001):
		j = 2 * i
		while j < 200001:
			pierwsza[j] = 0
			j += i
	pierwsze = []
	dick = {}
	for i in range(200001):
		if pierwsza[i] == 1:
			pierwsze.append(i)
			dick[i] = []
	for i in range(n):
		war = l[i]
		for pie in pierwsze:
			if pie > 450:
				break
			if war % pie == 0:
				expo = 0
				while war % pie == 0:
					war //= pie
					expo += 1
				dick[pie].append(expo)
		if war > 1:
			dick[war].append(1)
	wyn = 1
	for pie in pierwsze:
		if len(dick[pie]) < n - 1:
			continue
		elif len(dick[pie]) == n - 1:
			dick[pie].sort()
			wyn *= pie ** dick[pie][0]
		else:
			dick[pie].sort()
			wyn *= pie ** dick[pie][1]
	print(wyn)


from collections import defaultdict, Counter
n = int(input())
a = [int(x) for x in input().split()]

def fact(n):
	gaps = [1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6]
	(length, cycle) = (11, 3)
	(f, fs, nxt) = (2, [], 0)
	while f * f <= n:
		while n % f == 0:
			fs.append(f)
			n //= f
		f += gaps[nxt]
		nxt += 1
		if nxt == length:
			nxt = cycle
	if n > 1:
		fs.append(n)
	return dict(Counter(fs))
min_p = defaultdict(list)
cnt = defaultdict(int)
for i in range(n):
	fa = fact(a[i])
	for p in fa:
		cnt[p] += 1
		act = fa[p]
		l = min_p[p]
		l.append(act)
		l.sort()
		min_p[p] = l[:2]
ans = 1
for p in min_p:
	l = min_p[p]
	l.sort()
	if cnt[p] <= n - 2:
		exp = 0
	elif cnt[p] == n - 1:
		exp = l[0]
	else:
		exp = l[-1]
	ans *= p ** exp
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
g = a[-1]
gcd_suff = [0] * n
for i in range(n - 1, -1, -1):
	gcd_suff[i] = math.gcd(g, a[i])
	g = gcd_suff[i]
ans = a[0] * gcd_suff[0 + 1] // math.gcd(a[0], gcd_suff[0 + 1])
for i in range(0, n - 1):
	x = a[i] * gcd_suff[i + 1] // math.gcd(a[i], gcd_suff[i + 1])
	ans = math.gcd(ans, x)
print(ans)


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

def gcd3(a, b, c):
	return gcd(gcd(a, b), c)

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd4(a, b, c, d):
	return gcd(gcd(a, b), gcd(c, d))

def gcd6(a, b, c, d, e, f):
	return gcd(gcd3(a, b, c), gcd3(d, e, f))

def solve(a, n):
	if n == 3:
		return (gcd3(a[0], a[1], a[2]), gcd3(lcm(a[0], a[1]), lcm(a[1], a[2]), lcm(a[2], a[0])))
	if n == 2:
		g = gcd(a[0], a[1])
		return (g, a[0] * a[1] // g)
	(p, q) = solve(a[0:n // 2], n // 2)
	(r, s) = solve(a[n // 2:], n - n // 2)
	return (gcd4(p, q, r, s), gcd6(lcm(p, q), lcm(p, r), lcm(p, s), lcm(q, r), lcm(q, s), lcm(r, s)))
t = 1
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	(a1, ans) = solve(a, n)
	print(ans)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
n = int(input())
ints = list(map(int, input().split()))
lgcd = []
cuml = ints[0]
for j in range(len(ints)):
	cuml = math.gcd(cuml, ints[j])
	lgcd.append(cuml)
rgcd = []
cumr = ints[-1]
for j in range(len(ints) - 1, -1, -1):
	cumr = math.gcd(cumr, ints[j])
	rgcd.append(cumr)
rgcd = rgcd[::-1]
nin = []
for j in range(len(ints)):
	if j == 0:
		nin.append(rgcd[j + 1])
	elif j == len(ints) - 1:
		nin.append(lgcd[j - 1])
	else:
		nin.append(math.gcd(rgcd[j + 1], lgcd[j - 1]))
for j in range(len(ints)):
	nin[j] = nin[j] * ints[j] // math.gcd(nin[j], ints[j])
prod0 = nin[0]
for j in range(1, len(ints)):
	prod0 = math.gcd(prod0, nin[j])
print(prod0)


MOD = 10 ** 9 + 7
RLIMIT = 1000
DEBUG = 1

def main():
	for _ in inputt(1):
		(n,) = inputi()
		A = inputl()
		if n == 1:
			print(A[0])
		elif n == 2:
			print(A[0] * A[1] // gcd(*A))
		else:
			D = {d: [-inf, -inf] for d in factordict(A[0]) + factordict(A[1])}
			for a in A:
				p = factordict(a)
				for d in D:
					heappushpop(D[d], -p[d])
			debug(D)
			t = 1
			for (d, c) in D.items():
				t *= d ** (-c[0])
			print(t)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict, deque
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(RLIMIT)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	if DEBUG and (not __debug__):
		print('debug', *args, **kwargs)
		sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		if n <= self._list[-1]:
			return
		maxbase = int(n ** 0.5) + 1
		self.extend(maxbase)
		begin = self._list[-1] + 1
		newsieve = [i for i in range(begin, n + 1)]
		for p in self.primerange(2, maxbase):
			for i in range(-begin % p, len(newsieve), p):
				newsieve[i] = 0
		self._list.extend([x for x in newsieve if x])

	def extend_to_no(self, i):
		while len(self._list) < i:
			self.extend(int(self._list[-1] * 1.5))

	def primerange(self, a, b):
		a = max(2, a)
		if a >= b:
			return
		self.extend(b)
		i = self.search(a)[1]
		maxi = len(self._list) + 1
		while i < maxi:
			p = self._list[i - 1]
			if p < b:
				yield p
				i += 1
			else:
				return

	def search(self, n):
		if n < 2:
			raise ValueError
		if n > self._list[-1]:
			self.extend(n)
		b = bisect(self._list, n)
		if self._list[b - 1] == n:
			return (b, b)
		else:
			return (b, b + 1)

	def __contains__(self, n):
		if n < 2:
			raise ValueError
		if not n % 2:
			return n == 2
		(a, b) = self.search(n)
		return a == b

	def __getitem__(self, n):
		if isinstance(n, slice):
			self.extend_to_no(n.stop + 1)
			return self._list[n.start:n.stop:n.step]
		else:
			self.extend_to_no(n + 1)
			return self._list[n]
sieve = Sieve()

def isprime(n):
	if n <= sieve._list[-1]:
		return n in sieve
	for i in sieve:
		if not n % i:
			return False
		if n < i * i:
			return True
prime = sieve.__getitem__
primerange = lambda a, b=0: sieve.primerange(a, b) if b else sieve.primerange(2, a)

def factorint(n):
	factors = []
	for i in sieve:
		if n < i * i:
			break
		while not n % i:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
factordict = lambda n: Counter(factorint(n))
main()


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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
l = lcm(a[0], a[1])
g = gcd(a[0], a[1])
for x in a[2:]:
	l = gcd(l, lcm(x, g))
	g = gcd(x, g)
print(l)


n = int(input())
v = list(map(int, input().split()))
mx = max(v)
a = []
f = []
for i in range(mx + 1):
	a.append(i)
	f.append(0)
for i in v:
	f[i] = f[i] + 1
ans = 1
for i in range(2, mx + 1):
	if a[i] == i:
		mn = 10 ** 10
		second_mn = 10 ** 10
		cut = 0
		for j in range(i, mx + 1, i):
			if j % i == 0:
				a[j] = a[j] / i
				if f[j] > 0:
					x = 1
					y = j
					while y % i == 0:
						x = x * i
						y = y / i
					if x > 1:
						cut = cut + f[j]
						if x < mn:
							second_mn = mn
							mn = x
						else:
							second_mn = min(second_mn, x)
						if f[j] > 1:
							second_mn = min(x, second_mn)
							mn = min(x, mn)
		rep = min(2, n - cut)
		for i in range(rep):
			second_mn = mn
			mn = 1
		ans = ans * second_mn
print(ans)


import sys
mod = 1000000007
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import sqrt
ck = [i for i in range(200001)]
i = 2
for i in range(2, int(sqrt(200001)) + 1):
	if ck[i] == i:
		t = i * i
		for j in range(t, 200001, i):
			ck[j] = i
n = int(input())
d = dict()
a = list(map(int, input().split()))
for i in a:
	t = dict()
	p = i
	while ck[p] != p:
		t[ck[p]] = t.get(ck[p], 0) + 1
		p //= ck[p]
	t[ck[p]] = t.get(ck[p], 0) + 1
	for j in t:
		d[j] = d.get(j, [])
		d[j].append(t[j])
ans = 1
for i in d:
	if len(d[i]) == n - 1:
		ans *= i ** min(d[i])
	elif len(d[i]) == n:
		d[i].sort()
		ans *= i ** d[i][1]
print(ans)


n = int(input())
a = sorted(list(map(int, input().split(' '))))
d = {}

def pow_of(prime, number):
	i = 0
	divisor = 1
	while number % divisor == 0:
		i += 1
		divisor *= prime
	return i - 1

def p_upto(n):
	primes = [2, 3, 5, 7]
	i = 11
	while i <= n:
		bhul = True
		for p in primes:
			if i % p == 0:
				bhul = False
				break
		if bhul:
			primes.append(i)
		i += 1
	return primes
if len(a) == 1:
	print(a[0])
else:
	primes = p_upto(a[1])
	for prime in primes:
		min2 = []
		min2.append(pow_of(prime, a[0]))
		min2.append(pow_of(prime, a[1]))
		min2.sort()
		for i in range(2, len(a)):
			kk = pow_of(prime, a[i])
			if kk < min2[1]:
				min2[1] = kk
				min2.sort()
			if min2[1] == 0:
				break
		d[prime] = min2[1]
	ans = 1
	for x in primes:
		ans *= round(x ** d[x])
	print(ans)


import math

def prime(n):
	factor = {}
	tmp = int(math.sqrt(n)) + 1
	for num in range(2, tmp):
		while n % num == 0:
			n //= num
			if not num in factor.keys():
				factor[num] = 1
			else:
				factor[num] += 1
		if num > n:
			break
	if n != 1:
		if not n in factor.keys():
			factor[n] = 1
		else:
			factor[n] += 1
	return factor

def main():
	import sys
	input = sys.stdin.readline
	N = int(input())
	A = list(map(int, input().split()))
	dic = {}
	for a in A:
		fac = prime(a)
		for (num, c) in fac.items():
			if num in dic:
				dic[num].append(c)
			else:
				dic[num] = [c]
	ans = 1
	for (num, List) in dic.items():
		if len(List) <= N - 2:
			continue
		else:
			List.sort()
			if len(List) == N - 1:
				ans *= num ** List[0]
			else:
				ans *= num ** List[1]
	print(ans)
main()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
N = int(input())
array = sorted([int(x) for x in input().split()])
prefix_GCD = [0] * N
suffix_GCD = [0] * N
currentGCD = array[0]
for i in range(N):
	prefix_GCD[i] = gcd(currentGCD, array[i])
	currentGCD = gcd(currentGCD, array[i])
currentGCD = array[N - 1]
for i in range(N - 1, -1, -1):
	suffix_GCD[i] = gcd(currentGCD, array[i])
	currentGCD = gcd(currentGCD, array[i])
highest = 0
GCDs = []
for i in range(N):
	if i == 0:
		gcdwithout = suffix_GCD[1]
	elif i == N - 1:
		gcdwithout = prefix_GCD[-2]
	else:
		gcdwithout = gcd(prefix_GCD[i - 1], suffix_GCD[i + 1])
	GCDs.append(gcdwithout)
lcm = GCDs[0]
for i in GCDs[1:]:
	lcm = lcm * i // gcd(lcm, i)
print(lcm)


import math
n = int(input(''))
arr = list(map(int, input().split()))

def lcm_(a, b):
	return a * b // math.gcd(a, b)
suf = [1] * n
suf[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	suf[i] = math.gcd(arr[i], suf[i + 1])
lcm = []
for i in range(n - 1):
	lcm.append(lcm_(arr[i], suf[i + 1]))
sol = lcm[0]
for i in range(n - 1):
	sol = math.gcd(sol, lcm[i])
print(sol)


from collections import Counter
from math import gcd
n = int(input())
a = list(map(int, input().split()))
g = gcd(a[0], a[1])
ans = a[0] * a[1] // gcd(a[0], a[1])
for i in range(2, n):
	ng = gcd(g, a[i])
	ans = gcd(ans, a[i] * g // ng)
	g = ng
print(ans)


import math
from collections import Counter

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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
Q = []
k = 2
M = a[0]
while k * k <= M:
	if M % k == 0:
		M //= k
		Q.append(k)
	else:
		k += 1
if M > 1:
	Q.append(M)
k = 2
M = a[1]
while k * k <= M:
	if M % k == 0:
		M //= k
		Q.append(k)
	else:
		k += 1
if M > 1:
	Q.append(M)
C = Counter(Q)
ans = 1
for e in C:
	for f in range(C[e], 0, -1):
		c = 0
		for g in a:
			if g % e ** f == 0:
				c += 1
		if c >= n - 1:
			ans *= e ** f
			break
print(ans)


from sys import stdin, stdout
from math import sqrt
n = int(stdin.readline())
nums = sorted([int(x) for x in stdin.readline().split()])
if len(nums) == 1:
	print(nums[0])
else:
	primes = [2, 3, 5, 7, 11, 13]
	for num in range(17, nums[-1] + 1, 2):
		sq = sqrt(num)
		valid = True
		for n in primes:
			if num % n == 0:
				valid = False
				break
			if n > sq:
				break
		if valid:
			primes.append(num)
	primes = {n: [200000, 200000] for n in primes}
	for num in nums:
		rSet = []
		for p in primes:
			count = 0
			while num % p == 0:
				count += 1
				num = num // p
			if count < primes[p][0]:
				primes[p] = [count, primes[p][0]]
			elif count < primes[p][1]:
				primes[p][1] = count
			if primes[p][1] == 0:
				rSet.append(p)
		for p in rSet:
			del primes[p]
	base = 1
	for a in primes:
		base *= a ** primes[a][1]
	print(base)


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('C.txt').readlines())

	def input():
		return next(f)
else:
	input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
alen = max(A) + 1
T = [1] * (alen + 1)
T[0] = T[1] = 0
pos = 1
while pos < alen + 1:
	while pos < alen + 1 and T[pos] == 0:
		pos += 1
	for i in range(pos * 2, alen + 1, pos):
		T[i] = 0
	pos += 1
primes = [n for (n, i) in enumerate(T) if i == 1]
K = [0] * alen
for a in A:
	K[a] += 1
res = 1
for prime in primes:
	p = prime
	while p < alen:
		su = 0
		for u in range(p, alen, p):
			su += K[u]
		if su <= n - 2:
			break
		else:
			res *= prime
		p *= prime
print(res)


e = 200001
p = []
for i in range(e):
	p.append([])
for i in range(2, e):
	if not p[i]:
		for j in range(i, e, i):
			p[j] += [i]
d = {}
n = int(input())
l = list(map(int, input().split()))
g = {}
h = {}
for i in l:
	x = i
	for j in p[i]:
		try:
			d[j] += 1
		except:
			d[j] = 1
		f = 0
		while not x % j:
			x = x // j
			f += 1
		try:
			g[j] = min(g[j], f)
		except:
			g[j] = f
		try:
			h[j] += [f]
		except:
			h[j] = [f]
p = {}
for j in h:
	if len(h[j]) == n:
		x = sorted(h[j])
		p[j] = x[1]
ans = 1
for i in d:
	if d[i] == n:
		ans = ans * pow(i, p[i])
	elif d[i] == n - 1:
		ans = ans * pow(i, g[i])
print(ans)


import math
n = int(input())
suff_gcd = [0] * n
ar = list(map(int, input().split()))
suff_gcd[-1] = ar[-1]
for i in range(n - 2, -1, -1):
	suff_gcd[i] = math.gcd(suff_gcd[i + 1], ar[i])
temp = []
for i in range(0, n - 1):
	res = ar[i] * suff_gcd[i + 1] // suff_gcd[i]
	temp.append(res)
sol = temp[0]
for i in range(1, len(temp)):
	sol = math.gcd(sol, temp[i])
print(sol)


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
import sys
from functools import reduce
import sys

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
factors = defaultdict(list)

def calculate(n, factors):
	c = 0
	while n % 2 == 0:
		c += 1
		n //= 2
	factors[2].append(c)
	c = 0
	i = 3
	while i * i <= n:
		while n % i == 0:
			c += 1
			n //= i
		factors[i].append(c)
		c = 0
		i += 2
	if n > 1:
		factors[n].append(1)

def solve():
	global factors
	n = get_int()
	ls = get_list()
	for val in ls:
		calculate(val, factors)
	max_len = -1
	for (key, val) in factors.items():
		max_len = max(max_len, len(val))
	final_ans = 1
	for (key, val) in factors.items():
		val.sort()
		rem_len = max_len - len(val)
		if rem_len == 0:
			final_ans *= key ** val[1]
		elif rem_len == 1:
			final_ans *= key ** val[0]
	print(final_ans)

def main():
	solve()
TestCases = False
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def solve(array):
	lcm = array[0] * array[1] // gcd(array[0], array[1])
	current = lcm
	for i in range(2, len(array)):
		running = current * array[i] // gcd(current, array[i])
		lcm = gcd(lcm, running)
		current = gcd(current, array[i])
	print(lcm)
	return
n = int(input())
arr = list(map(int, input().split(' ')))
solve(arr)


import math
try:
	n = int(input())
	b = [0] * n
	a = list(map(int, input().split()))
	a.sort()
	var = a[n - 1]
	b[n - 1] = a[n - 1]
	i = n - 2
	while i >= 0:
		var = math.gcd(var, a[i])
		b[i] = var
		i -= 1
	var = a[0] * b[1]
	temp = b[0]
	for j in range(n - 1):
		a[j] *= b[j + 1]
		var = math.gcd(var, a[j])
	ans = var // temp
	print(ans)
except:
	pass


import io
import os
from collections import Counter, defaultdict, deque
from math import gcd
import heapq

def primeFactors(n):
	assert n >= 1
	factors = Counter()
	while n % 2 == 0:
		factors[2] += 1
		n //= 2
	x = 3
	while x * x <= n:
		while n % x == 0:
			factors[x] += 1
			n //= x
		x += 2
	if n != 1:
		factors[n] += 1
	return factors

def lcm(a, b):
	return a * b // gcd(a, b)

def brute(N, A):
	l = []
	for i in range(N):
		for j in range(i + 1, N):
			l.append(lcm(A[i], A[j]))
	g = 0
	for x in l:
		g = gcd(g, x)
	return g

def solve(N, A):
	pToCount = defaultdict(list)
	for x in A:
		for (p, count) in primeFactors(x).items():
			pToCount[p].append(count)
	g = 1
	for (p, counts) in pToCount.items():
		m = 0
		if N - len(counts) == 0:
			m = max(heapq.nsmallest(2, counts))
		elif N - len(counts) == 1:
			m = min(counts)
		g *= p ** m
	return g
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = solve(N, A)
print(ans)


from collections import defaultdict
MAXN = 200000
lf = [i for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
	if lf[p] == p:
		for m in range(p * p, MAXN + 1, p):
			lf[m] = p
	p += 1

def factorize(n):
	while n > 1:
		p = lf[n]
		e = 0
		while n % p == 0:
			n //= p
			e += 1
		yield (p, e)
n = int(input())
a = list(map(int, input().split()))
t = defaultdict(list)
for e in a:
	for (p, c) in factorize(e):
		t[p].append(c)
res = 1
for (p, l) in t.items():
	if len(l) < n - 1:
		continue
	while len(l) < n:
		l.append(0)
	l.sort()
	res *= p ** l[1]
print(res)


max_number = 200001
max_divider = 449
dividers = [1] * (max_number + 1)
for i in range(2, max_divider + 1):
	if dividers[i] != 1:
		continue
	for mult in range(i ** 2, max_number + 1, i):
		if dividers[mult] == 1:
			dividers[mult] = i
n = int(input())
a_arr = map(int, input().split())
factorization = {}
factorization_count = {}
for a in a_arr:
	prev_div = 1
	cnt = 0
	while True:
		div = dividers[a]
		if div == 1:
			div = a
		if div != prev_div and cnt:
			if prev_div in factorization:
				factorization_count[prev_div] += 1
				if cnt < factorization[prev_div][0]:
					factorization[prev_div] = [cnt, factorization[prev_div][0]]
				elif cnt < factorization[prev_div][1]:
					factorization[prev_div][1] = cnt
			else:
				factorization_count[prev_div] = 1
				factorization[prev_div] = [cnt, 100]
			cnt = 0
		cnt += 1
		if a == 1:
			break
		prev_div = div
		a = a // div
ans = 1
for div in factorization_count:
	cnt = factorization_count[div]
	if cnt == n:
		ans *= div ** factorization[div][1]
	elif cnt == n - 1:
		ans *= div ** factorization[div][0]
print(ans)


def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	l = [None] * n
	maxn = 10 ** 10
	alllcm = {}
	for (i, j) in enumerate(a):
		l[i] = PrimeFactorization(j)
		for k in l[i]:
			if not k in alllcm:
				alllcm[k] = 0
	ans = 1
	for k in alllcm:
		minl = [maxn, maxn]
		for d in l:
			if not k in d:
				minl[1] = minl[0]
				minl[0] = 0
			elif d[k] < minl[0]:
				minl[1] = minl[0]
				minl[0] = d[k]
			elif d[k] < minl[1]:
				minl[1] = d[k]
			else:
				continue
			if minl[1] == 0:
				break
		ans *= k ** minl[1]
	print(ans)

def PrimeFactorization(m):
	pf = {}
	for i in range(2, int(m ** 0.5) + 1):
		while m % i == 0:
			pf[i] = pf.get(i, 0) + 1
			m //= i
	if m > 1:
		pf[m] = 1
	return pf
resolve()


from math import gcd

def get_sieve_of_eratosthenes_new(n):
	import math
	if not isinstance(n, int):
		raise TypeError('n is int type.')
	if n < 2:
		raise ValueError('n is more than 2')
	prime = []
	limit = math.sqrt(n)
	data = [i + 1 for i in range(1, n)]
	while True:
		p = data[0]
		if limit <= p:
			return prime + data
		prime.append(p)
		data = [e for e in data if e % p != 0]
p = get_sieve_of_eratosthenes_new(430)
P = len(p)

def Ind(b, n):
	ans = 0
	while n % b == 0:
		ans += 1
		n //= b
	return ans
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	ans = a[0] * a[1] // gcd(a[0], a[1])
	print(ans)
else:
	prime = [[] for i in range(P)]
	large = {}
	for i in range(n):
		for j in range(P):
			num = Ind(p[j], a[i])
			prime[j].append(num)
			a[i] //= p[j] ** num
		if a[i] != 1:
			if a[i] not in large:
				large[a[i]] = 0
			large[a[i]] += 1
	ans = 1
	for i in range(P):
		test = prime[i]
		test.sort()
		(c1, c2) = (test[0], test[1])
		ans *= p[i] ** c2
	for lp in large:
		if large[lp] >= n - 1:
			ans *= lp
	print(ans)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
n = int(input())
l = list(map(int, input().split()))
suf = [0]
for i in range(n - 1, -1, -1):
	suf.append(gcd(l[i], suf[n - i - 1]))
suf.reverse()
ha = []
for i in range(n):
	g = suf[i + 1]
	ha.append(g * l[i] // gcd(g, l[i]))
ans = 0
for i in range(len(ha)):
	ans = gcd(ans, ha[i])
print(ans)


import sys
input = sys.stdin.readline

def prime(n):
	if n == 1:
		return []
	if n == 2:
		return [2]
	p = 2
	while p * p <= n:
		if n % p == 0:
			return [p] + prime(n // p)
		p += 1
	if p * p > n and n % p != 0:
		return [n]
n = int(input())
a = list(map(int, input().split()))
exp = [[] for _ in range(200000)]
for x in a:
	temp = prime(x)
	while temp != []:
		y = temp[0]
		c = temp.count(y)
		exp[y].append(c)
		temp = temp[c:]
prod = 1
for (i, x) in enumerate(exp):
	if len(x) <= n - 2:
		continue
	if len(x) == n - 1:
		x.append(0)
	x.sort()
	prod *= i ** x[1]
print(prod)


import math
from collections import defaultdict, Counter

def f(n):
	count = 0
	d = defaultdict(int)
	while (n % 2 > 0) == False:
		n >>= 1
		count += 1
	if count > 0:
		d[2] = count
	for i in range(3, int(math.sqrt(n)) + 1):
		count = 0
		while n % i == 0:
			count += 1
			n = int(n / i)
		if count > 0:
			d[i] = count
		i += 2
	if n > 2:
		d[n] = 1
	return d
n = int(input())
l = list(map(int, input().split()))
d1 = defaultdict(int)
d2 = defaultdict(list)
for i in l:
	d = f(i)
	for j in d:
		d1[j] += 1
		d2[j].append(d[j])
ans = 1
for j in d1:
	if d1[j] == n:
		d2[j].sort()
		ans *= j ** d2[j][1]
	elif d1[j] == n - 1:
		ans *= j ** min(d2[j])
print(ans)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import math as mt
MAXN = 200001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = defaultdict(int)
	while x != 1:
		ret[spf[x]] += 1
		x = x // spf[x]
	return ret
sieve()
n = INT()
a = LIST()
ones = 0
dd = defaultdict(list)
occ = defaultdict(int)
for el in a:
	if el == 1:
		ones += 1
	temp = getFactorization(el)
	for key in temp:
		dd[key].append(temp[key])
	for keyss in list(temp.keys()):
		occ[keyss] += 1
ans = 1
if ones >= 2:
	ans = 1
elif ones == 1:
	for key in occ:
		if occ[key] == n - 1:
			temp1 = sorted(dd[key])
			el = temp1[0]
			ans *= key ** el
else:
	for key in occ:
		if occ[key] == n:
			temp1 = sorted(dd[key])
			if len(temp1) >= 2:
				el = temp1[1]
			else:
				el = temp1[0]
			ans *= key ** el
		elif occ[key] == n - 1:
			temp1 = sorted(dd[key])
			el = temp1[0]
			ans *= key ** el
print(ans)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
aa = [int(i) for i in input().split()]
(ss, gg) = (0, aa[-1])
gg = gcd(gg, aa[-2])
if n == 2:
	ss = lcm(aa[0], aa[1])
else:
	for i in range(n - 3, -1, -1):
		ss = gcd(ss, lcm(aa[i], gg))
		gg = gcd(gg, aa[i])
print(ss)


from math import gcd, sqrt
from itertools import takewhile
from functools import reduce

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd_n(*args):
	return reduce(gcd, args)

def odd_numbers(start=3):
	while True:
		yield start
		start += 2

def primes():
	yield 2
	d = [2]
	gen = odd_numbers()
	while True:
		c = next(gen)
		if all([c % p for p in d]):
			yield c
			d.append(c)

def factorize(n, candidates=primes()):
	if n == 1:
		return {}
	f = {}
	num = n
	c = next(candidates)
	while c <= int(sqrt(num) + 1):
		if num % c == 0:
			f[c] = 0
			while num % c == 0:
				f[c] += 1
				num //= c
		c = next(candidates)
	if num > 1:
		f[num] = 1
	return f

def multiplicity(n, p):
	res = 0
	while n % p == 0:
		res += 1
		n //= p
	return res

def main():
	n = ri()
	a = ria()
	max_a = int(sqrt(max(a))) + 1
	cached_primes = list(takewhile(lambda p: p <= max_a, primes()))

	def pp(r, p):
		degrees = []
		deg0_count = 0
		for i in range(n):
			deg = multiplicity(a[i], p)
			degrees.append(deg)
			a[i] //= p ** deg
			if deg == 0:
				deg0_count += 1
			if deg0_count == 2:
				break
		deg = sorted(degrees)[1]
		return r * p ** deg
	res = 1
	for p in cached_primes:
		res = pp(res, p)
	left_pps = [ai for ai in a if ai > 1]
	for p in left_pps:
		res = pp(res, p)
	print(res)
main()


from math import gcd

def lcm(n, m):
	return int(n * m / gcd(n, m))
n = int(input())
arr = list(map(int, input().split()))
gc = gcd(arr[0], arr[1])
res = lcm(arr[0], arr[1])
for i in range(2, n):
	new_gcd = gcd(gc, arr[i])
	res = gcd(res, lcm(arr[i], gc))
	gc = new_gcd
print(res)


from functools import lru_cache
from fractions import gcd
from functools import reduce
n = int(input())
nums = list(map(int, input().split()))

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

def compute_lcm(x, y):
	lcm = x * y // compute_gcd(x, y)
	return lcm
gcd_array = [1] * n
gcd_array[n - 1] = nums[n - 1]
tn = n - 2
while tn >= 0:
	gcd_array[tn] = compute_gcd(gcd_array[tn + 1], nums[tn])
	tn -= 1
ans_1 = [0] * n
for i in range(n - 1):
	ans_1[i] = nums[i] * gcd_array[i + 1] / gcd_array[i]
final_ans = ans_1[0]
for i in range(2, n):
	final_ans = compute_gcd(final_ans, ans_1[i])
print(int(final_ans))


import math
from collections import defaultdict

def factorize(x):
	for i in range(2, int(math.sqrt(x) + 5)):
		cnt = 0
		while x % i == 0:
			x //= i
			cnt += 1
		if cnt:
			mp[i].append(cnt)
	if x > 1:
		mp[x].append(1)
n = int(input())
arr = list(map(int, input().split()))
mp = defaultdict(list)
ans = 1
for x in arr:
	factorize(x)
for (k, v) in mp.items():
	if len(v) < n - 1:
		continue
	p = sorted(v)[0] if len(v) == n - 1 else sorted(v)[1]
	ans *= k ** p
print(ans)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
g = []
for i in range(n):
	g.append(0)
g[n - 1] = a[n - 2] * a[n - 1]
g1 = a[n - 1]
for i in range(n - 2, 0, -1):
	g1 = gcd(a[i], g1)
	g[i] = a[i - 1] * g1
g1 = gcd(g1, a[0])
ans = g[1]
for i in range(1, n):
	ans = gcd(g[i], ans)
print(ans // g1)


from sys import stdin, gettrace
from collections import Counter
from heapq import nsmallest
if not gettrace():

	def input():
		return next(stdin)[:-1]
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def main():
	n = int(input())
	aa = [int(a) for a in input().split()]
	pcounts = [Counter() for _ in range(n)]
	pinst = [0] * 200001
	for (i, a) in enumerate(aa):
		for p in primes:
			if a == 1:
				break
			if a % p == 0:
				pinst[p] += 1
			while a % p == 0:
				pcounts[i][p] += 1
				a = a // p
		else:
			pcounts[i][a] += 1
			pinst[a] += 1
	res = 1
	for p in range(200001):
		if pinst[p] >= n - 1:
			exp = nsmallest(2, (pcounts[i][p] for i in range(n)))[1]
			res = res * p ** exp
	print(res)
main()


import math
n = int(input())
str1 = input()
lst1 = [int(i) for i in str1.split()]
prev_gcd = lst1[n - 1]
lst2 = []
for i in range(n - 2, -1, -1):
	temp = lst1[i] * prev_gcd // math.gcd(lst1[i], prev_gcd)
	lst2.append(temp)
	prev_gcd = math.gcd(prev_gcd, lst1[i])
ans = lst2[0]
for i in lst2:
	ans = math.gcd(ans, i)
print(ans)


import math
n = int(input())
l = list(map(int, input().split()))[:n]
t = [0] * n
t[n - 1] = l[n - 1]
for i in range(n - 1):
	t[n - i - 2] = math.gcd(t[n - i - 1], l[n - i - 2])
s = l[0] * t[1] // t[0]
for i in range(1, n - 1):
	s = math.gcd(s, l[i] * t[i + 1] // math.gcd(l[i], t[i + 1]))
print(s)


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

def lcm(a, b):
	return a * b / gcd(a, b)

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
l = list(map(int, input().split()))
if n == 2:
	print(int(lcm(l[0], l[1])))
else:
	h = l[::-1]
	k = []
	k.append(h[0])
	for i in range(1, n):
		k.append(gcd(k[i - 1], h[i]))
	h = k[::-1]
	g = []
	for i in range(n - 1):
		g.append(int(l[i] * h[i + 1] / h[i]))
	num1 = g[0]
	num2 = g[1]
	gcd = find_gcd(num1, num2)
	for i in range(2, len(g)):
		gcd = find_gcd(gcd, g[i])
	print(gcd)


import sys
input = sys.stdin.readline
n = int(input().strip())
a = [int(x) for x in input().strip().split()]
limit_prime = max(a)
primes = set(range(limit_prime + 1))
primes.discard(0)
primes.discard(1)
for e in list(primes):
	if e not in primes:
		continue
	v = e * 2
	while v <= limit_prime:
		primes.discard(v)
		v += e
r = 1
for prime in primes:
	second_smallest = smallest = float('inf')
	for e in a:
		c = 0
		while e % prime == 0:
			c += 1
			e //= prime
		if c < smallest:
			second_smallest = smallest
			smallest = c
			if second_smallest == 0:
				break
		elif c < second_smallest:
			second_smallest = c
			if second_smallest == 0:
				break
	if second_smallest > 0:
		r *= prime ** second_smallest
print(r)


from sys import stdin
import io
import os
from math import gcd
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = [a[-1]]
for i in range(n - 2, 0, -1):
	b.append(gcd(b[-1], a[i]))
temp = a[0] * b[-1] // gcd(a[0], b[-1])
b.pop()
for i in range(1, n - 1):
	temp = gcd(temp, a[i] * b[-1] // gcd(a[i], b[-1]))
	b.pop()
print(temp)


from collections import defaultdict
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))

def div(x):
	p = []
	if x % 2 == 0:
		c = 0
		while x % 2 == 0:
			x = x // 2
			c += 1
		p.append((2, c))
	for i in range(3, int(x ** 0.5) + 1, 2):
		if x % i == 0:
			c = 0
			while x % i == 0:
				x = x // i
				c += 1
			p.append((i, c))
	if x > 2:
		p.append((x, 1))
	return p
nb = defaultdict(lambda : [])
d = set()
i = n - 1
while i > -1:
	p = div(a[i])
	for (x, c) in p:
		nb[x].append(c)
		d.add(x)
	i -= 1
an = 1
for i in d:
	f = [c for c in nb[i]]
	f.sort()
	if len(f) == n:
		an *= i ** f[1]
	elif len(f) == n - 1:
		an *= i ** f[0]
print(an)


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
import heapq
maxN = 200001

def sieveOfEratosthenes(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i
s = [0] * (maxN + 10)
sieveOfEratosthenes(maxN + 1, s)

def generatePrimeFactors(N):
	llll = {}
	curr = s[N]
	cnt = 1
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		llll[curr] = cnt
		curr = s[N]
		cnt = 1
	return llll
N = int(input())
A = alele()
G = defaultdict(list)
for n in A:
	m = generatePrimeFactors(n)
	for (i, j) in m.items():
		G[i].append(j)
Ans = 1
for (i, j) in G.items():
	if len(j) <= N - 2:
		continue
	elif len(j) == N - 1:
		Ans *= i ** min(j)
	else:
		X = heapq.nsmallest(2, j)
		Ans *= i ** max(X)
print(Ans)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for __ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	suffix = [0] * n
	suffix[n - 1] = l[n - 1]
	g = l[n - 1]
	for i in range(n - 2, -1, -1):
		suffix[i] = mt.gcd(suffix[i + 1], l[i])
	for i in range(n - 1):
		g = l[i]
		g1 = mt.gcd(g, suffix[i + 1])
		g1 = suffix[i + 1] * g // g1
		if i == 0:
			g2 = g1
		g2 = mt.gcd(g1, g2)
	print(g2)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
num1 = list(map(int, input().split()))
num2 = [num1[-1]] * n
for i in range(2, n + 1):
	if i == 2:
		num2[-i] = gcd(num1[-i + 1], num1[-i])
	else:
		num2[-i] = gcd(num2[-i + 1], num1[-i])
num3 = []
for i in range(n - 1):
	num3.append(num1[i] * num2[i + 1] // gcd(num1[i], num2[i + 1]))
ans = num3[0]
for i in range(n - 2):
	if i == 0:
		ans = gcd(num3[i], num3[i + 1])
	else:
		ans = gcd(ans, num3[i + 1])
print(ans)


from functools import lru_cache
import math
from itertools import combinations

def lcm(a, b):
	return int(a * b / gcd(a, b))

@lru_cache(None)
def gcd(a, b):
	return math.gcd(a, b)
n = int(input())
arr = list(map(int, input().split()))
gcd_suffix = [0] * (n + 10)
gcd_suffix[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	gcd_suffix[i] = gcd(arr[i], gcd_suffix[i + 1])
b = [0] * (n + 10)
for i in range(0, n - 1):
	b[i] = arr[i] * gcd_suffix[i + 1] // gcd(arr[i], gcd_suffix[i + 1])
res = b[0]
for i in range(1, n):
	res = gcd(res, b[i])
print(res)


import math
q = int(input())
w = list(map(int, input().split()))
l = []
g = w[-1]
for i in range(q - 2, -1, -1):
	k = math.gcd(w[i], g)
	l.append(w[i] * (g // k))
	g = k
g = l[0]
for i in l[1:]:
	g = math.gcd(i, g)
print(g)


import sys
import math

def test():
	stdin = sys.stdin
	sys.stdin = open('input.txt')
	main()
	sys.stdin = stdin

def fib(x):
	ans = dict()
	for d in range(2, int(math.sqrt(x)) + 1):
		k = 0
		while x % d == 0:
			x //= d
			k += 1
		if k >= 1:
			ans[d] = k
	if x > 1:
		ans[x] = 1
	return ans

def fib_dicts(x, ld, rd):
	for p in ld:
		xp = 0
		while x % p == 0:
			xp += 1
			x //= p
		if xp < ld[p]:
			rd[p] = ld[p]
			ld[p] = xp
		elif xp < rd[p]:
			rd[p] = xp

def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	d1 = fib(a[0])
	d2 = fib(a[1])
	(ld, rd) = (dict(), dict())
	for key in list(d1.keys()) + list(d2.keys()):
		ld[key] = min(d1.get(key, 0), d2.get(key, 0))
		rd[key] = max(d1.get(key, 0), d2.get(key, 0))
	for item in a[2:]:
		fib_dicts(item, ld, rd)
	ans = 1
	for k in rd:
		ans *= k ** rd[k]
	print(ans)
main()


import math
n = int(input())
l = list(map(int, input().split()))
b = l[0] * l[1] // math.gcd(l[0], l[1])
g = math.gcd(l[0], l[1])
for i in l[2:]:
	g1 = math.gcd(i, g)
	b = math.gcd(b, i * g // g1)
	g = g1
print(b)


from math import gcd
N = int(input())
List = [int(x) for x in input().split()]
Suffix = [0] * N
Suffix[-1] = List[-1]
for i in range(N - 2, -1, -1):
	Suffix[i] = gcd(Suffix[i + 1], List[i])
Ans = 0
for i in range(N - 1):
	Ans = gcd(Ans, int(List[i] * Suffix[i + 1] / Suffix[i]))
print(Ans)


from math import gcd

def fun():
	n = int(input())
	arr = list(map(int, input().split()))
	whole = gcd(arr[0], arr[1])
	for i in range(2, n):
		whole = gcd(whole, arr[i])
	for i in range(n):
		arr[i] = arr[i] // whole
	prefix = [0] * n
	suffix = [0] * n
	prefix[0] = arr[0]
	suffix[-1] = arr[-1]
	for i in range(1, n):
		prefix[i] = gcd(prefix[i - 1], arr[i])
	for i in range(n - 2, -1, -1):
		suffix[i] = gcd(suffix[i + 1], arr[i])
	ans = whole
	for i in range(1, n - 1):
		ans *= gcd(prefix[i - 1], suffix[i + 1])
	ans *= prefix[n - 2]
	ans *= suffix[1]
	return ans
print(fun())


from math import gcd
from sys import stdin

def main():
	n = int(stdin.readline())
	ar = list(map(int, stdin.readline().split()))
	if n == 2:
		print(ar[0] * ar[1] // gcd(ar[0], ar[1]))
	else:
		mp = [0] * (2 * 10 ** 5 + 1)
		index = 2
		while index * index <= 200000:
			if mp[index] == 0:
				for j in range(index * index, 200001, index):
					if mp[j] == 0:
						mp[j] = index
			index += 1
		for i in range(2, 200001):
			if mp[i] == 0:
				mp[i] = i
		count = {}
		ap = {}
		for i in range(n):
			c = ar[i]
			while c != 1:
				curr = mp[c]
				if curr not in count:
					count[curr] = 1
				else:
					count[curr] += 1
				p = 0
				while c % curr == 0:
					c = c // curr
					p += 1
				if curr not in ap:
					ap[curr] = [p, 100000]
				elif p < ap[curr][0]:
					ap[curr] = [p, ap[curr][0]]
				elif p < ap[curr][1]:
					ap[curr] = [ap[curr][0], p]
		ans = 1
		for p in count:
			if count[p] == n:
				ans = ans * p ** ap[p][1]
			elif count[p] == n - 1:
				ans = ans * p ** ap[p][0]
		print(ans)
main()


from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())
n = gete(int)
a = geta(int)
INT_MAX = 1000000

def prime_factor(k: int):
	res = defaultdict(lambda : 0)
	i = 2
	while i * i <= k:
		while k % i == 0:
			k //= i
			res[i] += 1
		i += 1
	if k != 1:
		res[k] = 1
	return res
used_primes = dict()
ans = 1
for ai in a:
	fact = prime_factor(ai)
	for p in fact:
		f = fact[p]
		if p in used_primes:
			e = used_primes[p]
			if f <= e[0]:
				used_primes[p] = [f, e[0], e[2] + 1]
			elif f <= e[1]:
				used_primes[p][1] = f
				used_primes[p][2] += 1
			else:
				used_primes[p][2] += 1
		else:
			used_primes[p] = [f, INT_MAX, 1]
for p in used_primes:
	e = used_primes[p]
	ans *= 1 if e[2] <= n - 2 else p ** e[0] if e[2] == n - 1 else p ** e[1]
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = 1
m = [0] * 200000
for i in range(2, 200000):
	counter = 0
	fstpos = -1
	breakflag = 0
	r = 0
	while r < 2:
		breakflag = 0
		for j in range(n):
			if a[j] % i == 0:
				b = a[j] // i
				if (b + 1) * i <= a[j]:
					b += 1
				a[j] = b
			elif j != fstpos:
				r += 1
				if r == 2:
					breakflag = 1
				fstpos = j
			if breakflag == 1:
				break
		if breakflag == 1:
			break
		ans = ans * i
print(ans)


import sys
input = sys.stdin.readline

def sieve(m):
	isPrime = [True for _ in range(m)]
	primeDivisors = [[] for _ in range(m)]
	for num in range(2, m, 2):
		primeDivisors[num].append(2)
	for num in range(3, m, 2):
		if not isPrime[num]:
			continue
		for multiple in range(num, m, num):
			isPrime[multiple] = False
			primeDivisors[multiple].append(num)
	return primeDivisors

def main():
	mx = int(200000.0 + 5)
	primeDivisors = sieve(mx)
	n = int(input())
	ara = [int(num) for num in input().split()]
	if n == 1:
		print(ara[0])
		return
	ans = 1
	for prime in set(primeDivisors[ara[0]] + primeDivisors[ara[1]]):
		firstMin = int(10000000000.0)
		secondMin = int(10000000000.0)
		for num in ara:
			exp = 0
			while num % prime == 0:
				exp += 1
				num /= prime
			if exp < firstMin:
				secondMin = firstMin
				firstMin = exp
			elif exp < secondMin:
				secondMin = exp
			if secondMin == 0:
				break
		for _ in range(secondMin):
			ans *= prime
	print(ans)
main()


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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
ar = list(map(int, input().split()))
gpr = [0 for i in range(n)]
gsu = [0 for i in range(n)]
lc = [0 for i in range(n)]
gpr[0] = ar[0]
gsu[n - 1] = ar[n - 1]
for i in range(1, n):
	gpr[i] = gcd(gpr[i - 1], ar[i])
	gsu[n - i - 1] = gcd(gsu[n - i], ar[n - i - 1])
lc[0] = gsu[1]
lc[n - 1] = gpr[n - 2]
for i in range(1, n - 1):
	lc[i] = gcd(gpr[i - 1], gsu[i + 1])
ans = lc[0]
for i in range(1, n):
	ans = lcm(ans, lc[i])
print(ans)


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
arr = list(map(int, input().split()))
dp = [gcd(arr[-1], arr[-2])]
ss = [arr[-2] * arr[-1] // dp[-1]]
gg = ss[-1]
for i in range(n - 3, -1, -1):
	dp.append(gcd(arr[i], dp[-1]))
	ss.append(arr[i] * dp[-2] // dp[-1])
	gg = gcd(gg, ss[-1])
print(gg)


from collections import defaultdict

def factorize(n):
	a = 2
	fct = defaultdict(int)
	while a * a <= n:
		while n % a == 0:
			n //= a
			fct[a] += 1
		a += 1
	if n > 1:
		fct[n] += 1
	return fct
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(lambda : [10000, 10000])
cnt = defaultdict(int)
for x in a:
	c = factorize(x)
	for (k, v) in c.items():
		cnt[k] += 1
		if d[k][0] >= v:
			d[k][1] = d[k][0]
			d[k][0] = v
		elif d[k][1] >= v:
			d[k][1] = v
ans = 1
for (k, v) in d.items():
	if cnt[k] == n - 1:
		ans *= pow(k, v[0])
	if cnt[k] == n:
		ans *= pow(k, v[1])
print(ans)


import math
n = int(input())
arr = list(map(int, input().split()))
suffix = [0] * n
suffix[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	suffix[i] = math.gcd(arr[i], suffix[i + 1])
gcd1 = arr[0] * suffix[1] // suffix[0]
for i in range(1, n - 1):
	temp = arr[i] * suffix[i + 1] // suffix[i]
	gcd1 = math.gcd(temp, gcd1)
print(gcd1)


n = int(input())
A = list(map(int, input().split(' ')))
gcd = {}
gcd[1] = A[-1]

def GCD(a, b):
	if a == 0:
		return b
	return GCD(b % a, a)
temp = A[-1]
for i in range(n - 2, -1, -1):
	temp = GCD(temp, A[i])
	gcd[n - i] = temp
arr = []
for i in range(n - 1, 0, -1):
	arr.append(gcd[i] * A[n - i - 1])
temp = arr[0]
for i in range(1, len(arr) - 1):
	temp = GCD(temp, arr[i])
print(temp // gcd[len(A)])


import os
import sys
from io import BytesIO, IOBase
from math import gcd
from functools import reduce

def solution(arr, n):
	cur = arr[-1]
	suffix_gcd = [arr[-1]]
	for i in range(n - 2, -1, -1):
		cur = gcd(cur, arr[i])
		suffix_gcd.append(cur)
	suffix_gcd.reverse()
	final = []
	for i in range(n - 1):
		final.append(arr[i] * suffix_gcd[i + 1] // suffix_gcd[i])
	write(reduce(gcd, final))

def main():
	n = r_int()
	arr = r_array()
	solution(arr, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


import sys
import math

def read_line():
	return sys.stdin.readline()[:-1]

def read_int():
	return int(sys.stdin.readline())

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]

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

def lcm(a, b):
	return a * b // gcd(a, b)

def sieveOfEratosthenes(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	curr = s[N]
	cnt = 1
	ls = {}
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		ls[curr] = cnt
		curr = s[N]
		cnt = 1
	return ls
N = 200000 + 10
s = [0] * (N + 1)
sieveOfEratosthenes(N, s)
n = read_int()
a = read_int_line()
g = []
for i in range(n):
	g.append(generatePrimeFactors(a[i]))
ans = {}
d = 1
for i in range(n):
	for j in g[i]:
		if j in ans:
			ans[j].append(g[i][j])
		else:
			ans[j] = [g[i][j]]
l = -1
for i in ans:
	ans[i].sort()
	l = max(l, len(ans[i]))
d = {}
for i in ans:
	if len(ans[i]) != n:
		if len(ans[i]) == n - 1:
			d[i] = ans[i][0]
		else:
			d[i] = 0
	else:
		d[i] = ans[i][1]
an = 1
for i in ans:
	power = d[i]
	an = an * i ** power
print(an)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

class Prime:

	def __init__(self, n):
		self.M = m = int(math.sqrt(n)) + 10
		self.A = a = [True] * m
		a[0] = a[1] = False
		self.T = t = [2]
		for j in range(4, m, 2):
			a[j] = False
		for i in range(3, m, 2):
			if not a[i]:
				continue
			t.append(i)
			for j in range(i * i, m, i):
				a[j] = False
		self.ds_memo = {}
		self.ds_memo[1] = set([1])

	def is_prime(self, n):
		return self.A[n]

	def division(self, n):
		d = collections.defaultdict(int)
		for c in self.T:
			while n % c == 0:
				d[c] += 1
				n //= c
			if n < 2:
				break
		if n > 1:
			d[n] += 1
		return d.items()

def main():
	t = 1
	pr = Prime(2 * 10 ** 5)
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		c = collections.defaultdict(lambda : collections.defaultdict(int))
		for t in a:
			for (k, v) in pr.division(t):
				c[k][v] += 1
		r = 1
		for (k, v) in c.items():
			sv = sum(v.values())
			if sv < n - 1:
				continue
			ks = sorted(v.keys())[:2]
			if sv == n and v[ks[0]] == 1:
				r *= k ** ks[1]
			else:
				r *= k ** ks[0]
		rr.append(r)
	return JA(rr, '\n')
print(main())


def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while b:
		q = a // b
		(a, b) = (b, a - b * q)
	return a
n = int(input())
arr = [int(x) for x in input().split()]
d = gcd(arr[0], arr[1])
ans = arr[0] * arr[1] // d
for x in arr[2:]:
	ans = gcd(ans, x * d // gcd(x, d))
	d = gcd(d, x)
print(ans)


import math

def main():

	def lcm(a, b):
		return abs(a * b) // math.gcd(a, b)
	n = int(input())
	res = []
	arr = list(map(int, input().split()))
	j = 0
	for i in arr:
		res.append(lcm(i, j))
		j = math.gcd(j, i)
	result = res[0]
	for i in res:
		result = math.gcd(i, result)
	print(result)
	return
main()


(e, p, q) = ({}, {}, {})

def upd(x, y):
	e[x] = e.get(x, 0) + 1
	if y < p.get(x, 100):
		q[x] = p.get(x, 100)
		p[x] = y
	elif y < q.get(x, 100):
		q[x] = y
n = int(input())
for x in map(int, input().split()):
	d = 2
	while d * d <= x:
		if 0 == x % d:
			c = 0
			while 0 == x % d:
				x //= d
				c += 1
			upd(d, c)
		d += 1
	if x > 1:
		upd(x, 1)
ans = 1
for (k, v) in e.items():
	if v == n:
		for _ in range(q[k]):
			ans *= k
	elif v == n - 1:
		for _ in range(p[k]):
			ans *= k
print(ans)


def Sieve(n):
	ret = []
	divlis = [-1] * (n + 1)
	flag = [True] * (n + 1)
	flag[0] = False
	flag[1] = False
	ind = 2
	while ind <= n:
		if flag[ind]:
			ret.append(ind)
			ind2 = ind ** 2
			while ind2 <= n:
				flag[ind2] = False
				divlis[ind2] = ind
				ind2 += ind
		ind += 1
	return (ret, divlis)
(sev, divlis) = Sieve(210000)
n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in range(n):
	nd = {}
	na = a[i]
	while divlis[na] != -1:
		if divlis[na] not in nd:
			nd[divlis[na]] = 0
		nd[divlis[na]] += 1
		na //= divlis[na]
	if na != 1:
		if na not in nd:
			nd[na] = 1
		else:
			nd[na] += 1
	for x in nd:
		if x not in dic:
			dic[x] = []
		dic[x].append(nd[x])
ans = 1
for i in dic:
	if len(dic[i]) < n - 1:
		continue
	dic[i].sort()
	if len(dic[i]) == n:
		ans *= i ** dic[i][1]
	else:
		ans *= i ** dic[i][0]
print(ans)


from collections import Counter, defaultdict, deque
from math import gcd
import sys
input = sys.stdin.readline

def primes(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return factors

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	if n == 2:
		print(lcm(arr[0], arr[1]))
		return
	a = arr[0]
	b = arr[1]
	best = lcm(a, b)
	second = gcd(a, b)
	for i in range(2, n):
		el = arr[i]
		best = gcd(best, el) * gcd(second, best) // gcd(second, el)
		second = gcd(second, el)
	print(best)
tt = 1
for test in range(tt):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	n = int(input())
	nums = list(map(int, input().split()))
	primeList = [True] * (10 ** 5 * 2 + 1)
	primeList[0] = False
	primeList[1] = False
	prime = []
	for i in range(2, 10 ** 5 * 2 + 1):
		if primeList[i]:
			cnt = 2 * i
			prime.append(i)
			while cnt <= 10 ** 5 * 2:
				primeList[cnt] = False
				cnt += i
	ans = 1
	for i in prime:
		noCnt = 0
		bigCnt = 0
		tempList = []
		for j in nums:
			if j < i:
				bigCnt += 1
			if j % i or j < i:
				noCnt += 1
			else:
				tempj = j
				cnt = 0
				while not tempj % i:
					temp = 1
					while not tempj % i ** (temp * 2):
						temp <<= 1
					cnt += temp
					tempj = tempj // i ** temp
				if len(tempList) < 2:
					tempList.append(cnt)
					tempList.sort()
				elif tempList[0] <= cnt <= tempList[1]:
					tempList[1] = cnt
				elif cnt < tempList[0]:
					tempList[1] = tempList[0]
					tempList[0] = cnt
			if noCnt >= 2:
				break
		if bigCnt == n:
			break
		if noCnt == 0:
			ans *= i ** tempList[1]
		elif noCnt == 1:
			ans *= i ** tempList[0]
	print(ans)
	return
main()


from sys import stdin, stdout
from collections import defaultdict, Counter
input = stdin.buffer.readline
prime = [True for i in range(200000 + 1)]

def SieveOfEratosthenes():
	p = 2
	while p * p <= 200000:
		if prime[p] == True:
			for i in range(p * 2, 200000 + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
SieveOfEratosthenes()
v1 = [-1 for i in range(200000 + 1)]
v2 = [-1 for i in range(200000 + 1)]
n = int(input())
a = list(map(int, input().split()))
res = 1
for p in range(2, 200000 + 1):
	v1 = -1
	v2 = -1
	for x in a:
		nn = x
		value = 0
		if prime[p]:
			while nn % p == 0:
				nn //= p
				value += 1
		if v1 == -1 and v2 == -1:
			v2 = value
		elif v1 == -1:
			if v2 == value:
				v1 = value
			elif v2 < value:
				v1 = v2
				v2 = value
			else:
				v1 = value
		elif value < v2 and value >= v1:
			v2 = value
		elif value < v1:
			v2 = v1
			v1 = value
		if v1 == 0 and v2 == 0:
			break
	res *= p ** v2
print(res)


from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

class Sieve:

	def __init__(self, n):
		self.plist = [2]
		min_prime_factor = [2, 0] * (n // 2 + 5)
		for x in range(3, n + 1, 2):
			if min_prime_factor[x] == 0:
				min_prime_factor[x] = x
				self.plist.append(x)
				if x ** 2 > n:
					continue
				for y in range(x ** 2, n + 5, 2 * x):
					if min_prime_factor[y] == 0:
						min_prime_factor[y] = x
		self.min_prime_factor = min_prime_factor

	def isprime(self, x):
		return self.min_prime_factor[x] == x

	def pfct(self, x):
		(pp, ee) = ([], [])
		while x > 1:
			mpf = self.min_prime_factor[x]
			if pp and mpf == pp[-1]:
				ee[-1] += 1
			else:
				pp.append(mpf)
				ee.append(1)
			x //= mpf
		return [(p, e) for (p, e) in zip(pp, ee)]

def main():
	sv = Sieve(200005)
	n = II()
	aa = LI()
	ptoe = defaultdict(list)
	for a in aa:
		pe = sv.pfct(a)
		for (p, e) in pe:
			ptoe[p].append(e)
	ans = 1
	for (p, ee) in ptoe.items():
		if len(ee) < n - 1:
			continue
		ee.sort()
		if len(ee) == n - 1:
			ans *= p ** ee[0]
		else:
			ans *= p ** ee[1]
	print(ans)
main()


import sys
from math import ceil, sqrt
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())

def isp(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
primes = []
for _ in range(1):
	n = cin()
	a = li()
	vis = [0] * (max(a) + 10)
	for i in range(n):
		x = a[i]
		j = 1
		while j * j <= x:
			if x % j == 0:
				vis[j] += 1
				if x // j != j:
					vis[x // j] += 1
			j += 1
	ans = 1
	mx = max(a)
	for el in range(2, mx + 1):
		if not isp(el):
			continue
		mul = 1
		prd = el
		while prd <= mx:
			if vis[prd] >= n - 1:
				mul = prd
			prd *= el
		ans *= mul
	print(ans)


from collections import defaultdict as dd
from bisect import bisect as bc
import math as mt
ans = dd(list)
MAXN = 200007
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def pf(x):
	d = dd(int)
	while x != 1:
		d[spf[x]] += 1
		x = x // spf[x]
	for i in d:
		ans[i].insert(bc(ans[i], d[i]), d[i])
sieve()
n = int(input())
ar = list(map(int, input().split()))
z = 0
for i in ar:
	if i == 1:
		z += 1
	pf(i)
if z:
	for i in ans:
		for j in range(z):
			ans[i].insert(0, 0)
an = 1
for j in ans:
	for i in range(min(n - len(ans[j]), 2)):
		ans[j].insert(0, 0)
	an *= pow(j, ans[j][1])
print(an)


from math import sqrt
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def sol(n):
	res = {}
	while n % 2 == 0:
		if 2 not in res:
			res[2] = 1
		else:
			res[2] += 1
		n = n / 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			if i not in res:
				res[i] = 1
			else:
				res[i] += 1
			n = n / i
	if n > 2:
		if n not in res:
			res[n] = 1
		else:
			res[n] += 1
	return res

def second_smallest(numbers):
	m1 = m2 = 99 ** 9
	for x in numbers:
		if x <= m1:
			(m1, m2) = (x, m1)
		elif x < m2:
			m2 = x
	return m2
n = int(input())
l = list(map(int, input().split()))
p = max(l)
dd = {}
for i in range(n):
	el = l[i]
	p = sol(el)
	for a in p:
		if a not in dd:
			dd[a] = [p[a]]
		else:
			dd[a].append(p[a])
ans = 1
for i in dd:
	uz = len(dd[i])
	k = 0
	if uz == n - 1:
		k = min(dd[i])
	elif uz == n:
		k = second_smallest(dd[i])
	ans *= i ** k
print(int(ans))


from collections import defaultdict
(n, a) = (int(input()), list(map(int, input().strip().split())))
primes = [i for i in range(2 * 10 ** 5 + 1)]
result = 1
counts = defaultdict(int)
for i in range(2, len(primes)):
	if primes[i] == i:
		indeks = i * i
		while indeks < len(primes):
			primes[indeks] = i
			indeks += i
for number in a:
	factors = defaultdict(int)
	x = number
	while x > 1:
		least = primes[x]
		factors[least] += 1
		x = x // least
	for (prime, cnt) in factors.items():
		for i in range(1, cnt + 1):
			counts[prime ** i, prime] += 1
for ((value, prime), cnt) in counts.items():
	if cnt >= n - 1:
		result *= prime
print(result)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	n = I()
	arr = L()
	ans = [0 for i in range(n - 1)]
	ans[n - 2] = arr[n - 1]
	for i in range(n - 3, -1, -1):
		ans[i] = math.gcd(arr[i + 1], ans[i + 1])
	ngcd = arr[0] * ans[0] // math.gcd(arr[0], ans[0])
	for i in range(1, n - 1):
		gc = arr[i] * ans[i] // math.gcd(arr[i], ans[i])
		ngcd = math.gcd(gc, ngcd)
	print(ngcd)
main()


def gf(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def razlozhitb(n):
	ans = list()
	while n > 1:
		g = gf(n)
		ans.append(g)
		n //= g
	return ans
n = int(input())
a = map(int, input().split())
kek = [razlozhitb(x) for x in a]
kek2 = {}
for i in kek:
	nj = 0
	cj = 0
	for j in i:
		if nj != j:
			cj = 1
			nj = j
		else:
			cj += 1
		now = kek2.get((nj, cj), 0)
		kek2[nj, cj] = now + 1
res = 1
for (k, v) in kek2.items():
	if v >= n - 1:
		res *= k[0]
print(res)


import math

def p_dec(n):
	res = list()
	while n > 1:
		i = 2
		while i <= n:
			if n % i == 0:
				res.append(i)
				n //= i
			else:
				i += 1
	return res
n = int(input())
A = list(map(int, input().split(' ')))
if n < 2:
	print(A[0])
else:
	lcm = A[0] * A[1] // math.gcd(A[0], A[1])
	pd = p_dec(lcm)
	res = 1
	for prime in pd:
		encountered = 0
		for i in range(len(A)):
			if A[i] % prime == 0:
				encountered += 1
				A[i] //= prime
			if i + 1 - encountered > 1:
				break
		if encountered >= n - 1:
			res *= prime
	print(res)


from sys import stdin
from bisect import bisect_left as bl
from bisect import bisect_right as br
from functools import reduce

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())

class RangedList:

	def __init__(self, start, stop, val=0):
		self.shift = 0 - start
		self.start = start
		self.stop = stop
		self.list = [val] * (stop - start)

	def __setitem__(self, key, value):
		self.list[key + self.shift] = value

	def __getitem__(self, key):
		return self.list[key + self.shift]

	def __repr__(self):
		return str(self.list)

	def __iter__(self):
		return iter(self.list)

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

def fact(x):
	factors = []
	r = 1
	while r ** 2 <= x:
		if x % r == 0:
			factors.append(r)
			o = x // r
			if o != r:
				factors.append(o)
		r += 1
	return factors
debugging = 1
counts = [0] * 200001
n = intput()
a = list(intsput())
for i in range(len(a)):
	x = a[i]
	f = fact(x)
	for k in f:
		counts[k] += 1
needed = []
for i in range(1, len(counts)):
	e = counts[i]
	if e in (n, n - 1):
		needed.append(i)
ans = 1
for x in needed:
	ans = lcm(ans, x)
print(ans)


from sys import stdin
from math import gcd
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
gc = [arr[-1]]
for i in range(n - 2, 0, -1):
	gc.append(gcd(gc[-1], arr[i]))
ans = arr[0] * gc[-1] // gcd(arr[0], gc[-1])
for i in range(1, n - 1):
	ans = gcd(ans, arr[i] * gc[-1 - i] // gcd(arr[i], gc[-1 - i]))
print(ans)


N = int(input())
number = list(map(int, input().split()))
dpl = [0 for i in range(N)]
dpr = [0 for i in range(N)]
import math
dpl[0] = number[0]
for i in range(1, N):
	dpl[i] = math.gcd(dpl[i - 1], number[i])
dpr[-1] = number[-1]
for i in range(2, N + 1):
	dpr[-i] = math.gcd(dpr[-i + 1], number[-i])
gcds = [0 for i in range(N)]
for i in range(N):
	if i == 0:
		gcds[i] = dpr[1]
	elif i == N - 1:
		gcds[i] = dpl[-2]
	else:
		gcds[i] = math.gcd(dpl[i - 1], dpr[i + 1 - N])

def union_lcm(lists):
	if len(lists) == 1:
		return lists[0]
	elif len(lists) > 1:
		num = lists[0]
		for i in range(1, len(lists)):
			num = num * lists[i] // math.gcd(num, lists[i])
		return num
print(union_lcm(gcds))


def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase
from math import gcd

def div(x):
	an = []
	for i in range(1, int(x ** 0.5) + 1):
		if not x % i:
			an.extend([i, x // i])
	if len(an) >= 2 and an[-1] == an[-2]:
		an.pop()
	return an

def main():
	n = int(input())
	a = list(map(int, input().split()))
	arr = [0] * 200001
	x = 1
	for i in a:
		for j in div(i):
			c = 0
			if arr[j]:
				continue
			arr[j] = 1
			for k in a:
				if k % j:
					c += 1
				if c > 1:
					break
			if c <= 1:
				x = x * j // gcd(x, j)
	print(x)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


n = int(input())
arr = input().split(' ')
lis = [int(s) for s in arr]
prime = [True for i in range(200001)]
p = 2
while p <= 200000:
	if prime[p] == True:
		for i in range(p * p, 200001, p):
			prime[i] = False
	p += 1
prime[1] = False
primes = []
ans = 1
for i in range(2, 200000):
	if prime[i] == True:
		primes.append(i)
for p in primes:
	fmn = 100
	smn = 100
	for ele in lis:
		if fmn == 0 and smn == 0:
			break
		cnt = 0
		while ele % p == 0:
			cnt += 1
			ele = ele / p
		if cnt <= fmn and cnt < smn:
			smn = fmn
			fmn = cnt
		elif cnt < smn:
			smn = cnt
	ans = ans * pow(p, smn)
print(ans)


from math import gcd

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
a = [int(x) for x in input().split()]
t = a[n - 1]
ans = a[n - 1]
for i in range(n - 2, -1, -1):
	if i == n - 2:
		ans = lcm(a[i], t)
	else:
		ans = gcd(ans, lcm(a[i], t))
	t = gcd(t, a[i])
print(ans)


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

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if a % b == 0:
		return b
	if a == 1 or b == 1:
		return 1
	return gcd(b, a % b)
gcds = [0 for i in range(n)]
gcds[-1] = a[-1]
for i in range(n - 2, -1, -1):
	gcds[i] = gcd(a[i], gcds[i + 1])
final = []
for i in range(0, n - 1):
	final.append(a[i] * gcds[i + 1] // gcds[i])
ans = final[0]
for i in range(1, len(final)):
	ans = gcd(ans, final[i])
print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import gcd

def main():
	n = N()
	arr = RLL()
	garr = [0] * n
	now = arr[-1]
	for i in range(n - 1, -1, -1):
		now = gcd(now, arr[i])
		garr[i] = now
	for i in range(n - 1):
		garr[i] = garr[i + 1] * arr[i] // gcd(garr[i + 1], arr[i])
	res = garr[0]
	for i in garr[:-1]:
		res = gcd(i, res)
	print(res)
main()


from collections import Counter
from math import log2
from math import gcd
n = int(input())
arr = list(map(int, input().split()))
s = [0] * n
s[n - 1] = arr[-1]
var = arr[-1]
for i in range(n - 2, -1, -1):
	s[i] = gcd(arr[i], s[i + 1])
for i in range(n - 1):
	cnt = arr[i] * s[i + 1] // gcd(arr[i], s[i + 1])
	if i == 0:
		ans = cnt
	else:
		ans = gcd(ans, cnt)
print(ans)


import os
import sys
from io import BytesIO, IOBase

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

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	t = 1
	for xx in range(t):
		n = int(input())
		ar = list(map(int, input().split()))
		gpr = [0 for i in range(n)]
		gsu = [0 for i in range(n)]
		lc = [0 for i in range(n)]
		gpr[0] = ar[0]
		gsu[n - 1] = ar[n - 1]
		for i in range(1, n):
			gpr[i] = gcd(gpr[i - 1], ar[i])
			gsu[n - i - 1] = gcd(gsu[n - i], ar[n - i - 1])
		lc[0] = gsu[1]
		lc[n - 1] = gpr[n - 2]
		for i in range(1, n - 1):
			lc[i] = gcd(gpr[i - 1], gsu[i + 1])
		ans = lc[0]
		for i in range(1, n):
			ans = lcm(ans, lc[i])
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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

def gcd(a, b):
	if b > a:
		t = a
		a = b
		b = t
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b
	return b
x = gcd(a[0], a[1])
ans = a[0] * a[1] // x
if n > 2:
	for i in range(2, n):
		y = gcd(a[i], x)
		lcm = x * a[i] // y
		ans = gcd(ans, lcm)
		x = y
print(ans)


import math
import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = list(map(int, input().split()))
suffix = [0] * n
suffix[-1] = a[-1]
for i in range(n - 2, -1, -1):
	suffix[i] = math.gcd(a[i], suffix[i + 1])
gcd1 = a[0] * suffix[1] // suffix[0]
for i in range(1, n - 1):
	lcm = a[i] * suffix[i + 1] // suffix[i]
	gcd1 = math.gcd(lcm, gcd1)
print(gcd1)


import sys, math
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(n)]
C = [0 for i in range(n - 1)]
B[n - 1] = A[n - 1]
for j in range(n - 2, -1, -1):
	B[j] = math.gcd(A[j], B[j + 1])
for j in range(n - 1):
	C[j] = A[j] * B[j + 1] // math.gcd(A[j], B[j + 1])
g = C[0]
for k in range(1, n - 1):
	g = math.gcd(g, C[k])
print(int(g))


import math

def zeta_gcd(a, primes):
	n = len(a) - 1
	for p in primes:
		for i in range(n // p, 0, -1):
			a[i] += a[p * i]

def mobius_gcd(a, primes):
	n = len(a)
	for p in primes:
		for i in range(1, n):
			if i * p >= n:
				break
			a[i] -= a[p * i]

def get_primes(n):
	is_prime = [True] * (n + 1)
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if not is_prime[i]:
			continue
		for j in range(i * 2, n + 1, i):
			is_prime[j] = False
	return [i for i in range(n + 1) if is_prime[i]]
NNN = 2 * 10 ** 5 + 1
(N,) = map(int, input().split())
X = list(map(int, input().split()))
primes = get_primes(NNN)
fs = [0] * NNN
for x in X:
	fs[x] += 1
zeta_gcd(fs, primes)
R = 1
for (i, f) in enumerate(fs):
	if f >= N - 1:
		R = R * i // math.gcd(R, i)
print(R)


import math
n = int(input())
l = list(map(int, input().split()))
dp = [0 for ti in range(n + 1)]
ans = 0
dp[n] = l[n - 1]
for i in range(n - 1, 0, -1):
	dp[i] = math.gcd(l[i - 1], dp[i + 1])
	ans = math.gcd(ans, l[i - 1] * dp[i + 1] // dp[i])
print(ans)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
n = int(input())
arr = [int(x) for x in input().split()]
suffixGCD = [0 for i in range(n)]
suffixGCD[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	suffixGCD[i] = gcd(suffixGCD[i + 1], arr[i])
ans = 0
ans = arr[0] * suffixGCD[1] // gcd(arr[0], suffixGCD[1])
for i in range(1, n - 1):
	ans = gcd(ans, arr[i] * suffixGCD[i + 1] // gcd(arr[i], suffixGCD[i + 1]))
print(ans)


import sys, math
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
import collections as col
import math

def prime_factors(n):
	factors = []
	num = 0
	while n % 2 == 0:
		num += 1
		n //= 2
	if num:
		factors.append((2, num))
	i = 3
	while n > 1 and i * i <= n:
		num = 0
		while n % i == 0:
			num += 1
			n //= i
		if num:
			factors.append((i, num))
		i += 2
	if n > 2:
		factors.append((n, 1))
	return factors

def solve():
	N = getInt()
	A = getInts()
	primes = col.defaultdict(list)
	for n in range(N):
		facs = prime_factors(A[n])
		for (f, count) in facs:
			primes[f].append(count)
	ans = 1
	for p in primes:
		tmp = sorted(primes[p])
		if len(tmp) < N - 1:
			continue
		if len(tmp) == N - 1:
			ans *= p ** tmp[0]
		if len(tmp) == N:
			ans *= p ** tmp[1]
	return ans
print(solve())


from collections import Counter
import math
mod = 10 ** 9 + 7
n = int(input())
arr = [int(i) for i in input().split()]
suffix = [arr[-1]]
for i in range(n - 1):
	x = suffix[0]
	y = math.gcd(x, arr[n - i - 2])
	suffix.insert(0, y)
ans = []
for i in range(n - 1):
	x = arr[i] * suffix[i + 1] // math.gcd(arr[i], suffix[i + 1])
	ans.append(x)
a = ans[0]
for i in range(n - 2):
	a = math.gcd(a, ans[i + 1])
print(a)


from math import gcd

def lcm(s, t):
	return s * t // gcd(s, t)
n = int(input())
a = list(map(int, input().split()))
la = [a[i] for i in range(n)]
ra = [a[i] for i in range(n)]
for i in range(n - 1):
	la[i + 1] = gcd(la[i + 1], la[i])
for i in range(1, n)[::-1]:
	ra[i - 1] = gcd(ra[i], ra[i - 1])
sa = [0] * n
sa[0] = ra[1]
sa[-1] = la[-2]
for i in range(1, n - 1):
	sa[i] = gcd(la[i - 1], ra[i + 1])
x = sa[0]
for i in range(1, n):
	x = lcm(x, sa[i])
print(x)


import math
n = int(input())
a = list(map(int, input().strip().split(' ')))
ans = a[0] * a[1] // math.gcd(a[0], a[1])
g = math.gcd(a[0], a[1])
for i in a[2:]:
	newg = math.gcd(i, g)
	ans = math.gcd(ans, i * g // newg)
	g = newg
print(int(ans))


import math
import collections
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
pre = [1] * n
suf = [1] * n
gp = a[0]
gs = a[-1]
g = a[0]
for i in range(n):
	g = gcd(a[i], g)
for i in range(n):
	a[i] = a[i] // g
ans = g
for i in range(n):
	gp = gcd(a[i], gp)
	gs = gcd(a[-i - 1], gs)
	pre[i] = gp
	suf[-i - 1] = gs
fin = []
for i in range(n):
	if i == 0:
		fin.append(a[i] * suf[i + 1])
	elif i == n - 1:
		fin.append(a[i] * pre[n - 2])
	else:
		fin.append(a[i] * gcd(pre[i - 1], suf[i + 1]))
f = fin[0]
for i in range(n):
	f = gcd(fin[i], f)
print(ans * f)


from collections import Counter
from math import floor, sqrt
try:
	long
except NameError:
	long = int

def fac(n):
	step = lambda x: 1 + (x << 2) - (x >> 1 << 1)
	maxq = long(floor(sqrt(n)))
	d = 1
	q = 2 if n % 2 == 0 else 3
	while q <= maxq and n % q != 0:
		q = step(d)
		d += 1
	return [q] + fac(n // q) if q <= maxq else [n]
for _ in range(1):
	n = int(input())
	li = list(map(int, input().split()))
	e = [[] for i in range(200007)]
	d = [0 for i in range(200007)]
	for i in li:
		k = Counter(fac(i))
		for j in k:
			e[j].append(k[j])
			d[j] += 1
	ans = 1
	for i in range(200007):
		if d[i] == n:
			p = min(e[i])
			f = 30
			o = 0
			for l in e[i]:
				if l != p:
					o += 1
					f = min(f, l)
			if o == n - 1:
				p = f
			ans *= i ** p
		if d[i] == n - 1:
			ans *= i ** min(e[i])
	print(ans)


from itertools import combinations
from collections import Counter
from sys import stdin, stdout
import functools
from math import gcd

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_list():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def get_singleInt():
	return int(stdin.readline())

def main():
	length = get_singleInt()
	array = get_list()
	stdout.write(str(required(array, length)) + '\n')

def required(lst, length):
	g = gcd(lst[0], lst[1])
	lcm = lst[0] * lst[1] // g
	for elem in lst[2:]:
		lcm = gcd(lcm, elem * g // gcd(elem, g))
		g = gcd(g, elem)
	return lcm

def lcm(a, b):
	return a * b // gcd(a, b)
main()


def primes235(limit):
	yield 2
	yield 3
	yield 5
	if limit < 7:
		return
	modPrms = [7, 11, 13, 17, 19, 23, 29, 31]
	gaps = [4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 2, 4, 6, 2, 6]
	ndxs = [0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7]
	lmtbf = (limit + 23) // 30 * 8 - 1
	lmtsqrt = int(limit ** 0.5) - 7
	lmtsqrt = lmtsqrt // 30 * 8 + ndxs[lmtsqrt % 30]
	buf = [True] * (lmtbf + 1)
	for i in range(lmtsqrt + 1):
		if buf[i]:
			ci = i & 7
			p = 30 * (i >> 3) + modPrms[ci]
			s = p * p - 7
			p8 = p << 3
			for j in range(8):
				c = s // 30 * 8 + ndxs[s % 30]
				buf[c::p8] = [False] * ((lmtbf - c) // p8 + 1)
				s += p * gaps[ci]
				ci += 1
	for i in range(lmtbf - 6 + ndxs[(limit - 7) % 30]):
		if buf[i]:
			yield (30 * (i >> 3) + modPrms[i & 7])
pp = list(primes235(5000))

def decomp(n):
	d = {}
	for p in pp:
		if n % p == 0:
			k = 0
			while n % p == 0:
				n //= p
				k += 1
			d[p] = k
			if n == 1:
				break
	if n > 1:
		d[n] = 1
	return d

def cnt(n, p):
	k = 0
	while n % p == 0:
		n //= p
		k += 1
	return k
n = int(input())
a = map(int, input().split())
x = decomp(next(a))
y = decomp(next(a))
for v in x:
	y[v] = y.get(v, 0)
for v in y:
	x[v] = x.get(v, 0)
	(x[v], y[v]) = (min(x[v], y[v]), max(x[v], y[v]))
for u in a:
	for v in x:
		if y[v] > 0:
			z = cnt(u, v)
			if z < x[v]:
				y[v] = x[v]
				x[v] = z
			elif z < y[v]:
				y[v] = z
res = 1
for (p, k) in y.items():
	if k > 0:
		res *= p ** k
print(res)


from math import gcd

def lcm(a, b):
	return int(a * b / gcd(a, b))
n = int(input())
l = list(map(int, input().split()))
num1 = l[0]
num2 = l[1]
gcd1 = gcd(num1, num2)
s = lcm(l[0], l[1])
for i in range(2, n):
	gcd2 = gcd(gcd1, l[i])
	s = gcd(s, lcm(l[i], gcd1))
	gcd1 = gcd2
print(s)


import math
n = int(input())
s = list(map(int, input().split()))
MAXN = 200001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, math.ceil(math.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = {}
	while x != 1:
		spfx = spf[x]
		r = ret.get(spfx, 0)
		ret[spfx] = r + 1
		x = x // spf[x]
	return ret
sieve()
primes = {}
for si in s:
	p = getFactorization(si)
	for (prime, power) in p.items():
		l = primes.get(prime, [])
		l.append(power)
		primes[prime] = l
res = 1
for (prime, powers) in primes.items():
	npowers = len(powers)
	if npowers < n - 1:
		continue
	else:
		spowers = sorted(powers)
		if npowers == n:
			res *= prime ** spowers[1]
		elif npowers == n - 1:
			res *= prime ** spowers[0]
print(res)


import math
n = int(input())
l = [int(x) for x in input().split()]
pre = [l[0]]
suf = [l[-1]]
for i in range(1, n):
	pre.append(int(math.gcd(pre[-1], l[i])))
for i in range(n - 2, -1, -1):
	suf.append(int(math.gcd(l[i], suf[-1])))
suf = suf[::-1]
final = []
for i in range(n):
	if i - 1 < 0:
		final.append(suf[i + 1])
		continue
	elif i + 1 >= n:
		final.append(pre[i - 1])
	else:
		final.append(int(math.gcd(suf[i + 1], pre[i - 1])))
ans = final[0]
for i in range(1, n):
	ans = ans * final[i] / math.gcd(ans, final[i])
	ans = int(ans)
print(int(ans))


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

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(n, array):
	pref = [0 for i in range(n)]
	suff = [0 for i in range(n)]
	g = [0 for i in range(n)]
	for i in range(1, n):
		pref[i] = gcd(pref[i - 1], array[i - 1])
		suff[n - 1 - i] = gcd(suff[n - i], array[n - i])
	g[0] = suff[0]
	g[-1] = pref[-1]
	for i in range(1, n - 1):
		g[i] = gcd(pref[i], suff[i])
	ans = 1
	for i in range(n):
		ans = lcm(ans, g[i])
	return ans
n = int(input())
array = [int(s) for s in input().split()]
print(solve(n, array))


import sys
from heapq import heapify, heappop, heappush

def solve():
	input = sys.stdin.readline
	N = int(input())
	A = [int(a) for a in input().split()]
	A.sort()
	maxMult = A[0] * A[1]
	mA = max(A)
	isPrime = [True] * (mA + 1)
	ans = 1
	for i in range(2, mA + 1):
		if isPrime[i]:
			k = i * 2
			while k <= mA:
				isPrime[k] = False
				k += i
			if maxMult % i == 0:
				L = []
				heapify(L)
				for (j, a) in enumerate(A):
					b = a
					c = 0
					while b % i == 0:
						c += 1
						b //= i
					heappush(L, -c)
					if j >= 2:
						heappop(L)
				count = -1 * heappop(L)
				ans *= pow(i, count)
	print(ans)
	return 0
solve()


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: gcd(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_right, bisect_left
from fractions import Fraction

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(a[0])
		quit()
	st = SegmentTree(a)
	ans = 1
	for i in range(n):
		if i == 0:
			g = st.query(1, n - 1)
		elif i == n - 1:
			g = st.query(0, n - 2)
		else:
			g = gcd(st.query(0, max(i - 1, 0)), st.query(min(n - 1, i + 1), n - 1))
		ans = lcm(ans, g)
	print(ans)


import sys, math
input = sys.stdin.buffer.readline

def primes(n):
	ass = []
	is_prime = [True] * (n + 1)
	is_prime[0] = False
	is_prime[1] = False
	for i in range(2, int(n ** 0.5) + 1):
		if not is_prime[i]:
			continue
		for j in range(i * 2, n + 1, i):
			is_prime[j] = False
	for i in range(len(is_prime)):
		if is_prime[i]:
			ass.append(i)
	return ass
n = int(input())
a = list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
if n == 2:
	print(lcm(a[0], a[1]))
	exit()
pr = primes(2500)
res = 1
for e in pr:
	mi = 10 ** 6
	nx = 10 ** 6
	for i in range(n):
		c = 0
		while a[i] % e == 0:
			c += 1
			a[i] = a[i] // e
		if c < mi:
			(mi, nx) = (c, mi)
		elif c < nx:
			nx = c
	if nx != 10 ** 6:
		res = res * e ** nx
a.sort()
if a[1] == a[-1]:
	res *= a[1]
elif a[0] == a[-2]:
	res *= a[0]
print(res)


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict, Counter
n = int(input())
(*a,) = map(int, input().split())

def factorization(n) -> Counter:
	if n == 1:
		return Counter()
	ret = []
	i = 2
	while i * i <= n:
		while n % i == 0:
			n //= i
			ret.append(i)
		i += 1
	if n != 1:
		ret.append(n)
	return Counter(ret)
dd = defaultdict(list)
cnt = Counter()
for x in a:
	fac = factorization(x)
	for (k, v) in fac.items():
		cnt[k] += 1
		dd[k].append(v)
ans = 1
for (k, li) in dd.items():
	if cnt[k] < n - 1:
		continue
	elif cnt[k] == n - 1:
		ans *= k ** min(li)
	else:
		li.remove(min(li))
		ans *= k ** min(li)
print(ans)


import sys
from collections import defaultdict, Counter
readline = sys.stdin.readline

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

def lcm(a, b):
	return a * b // gcd(a, b)
M = 2 * 10 ** 5 + 2
prime = [0] * M
for i in range(2, M):
	if prime[i]:
		continue
	for j in range(i, M, i):
		if not prime[j]:
			prime[j] = i

def pd(x):
	C = Counter()
	while x > 1:
		C[prime[x]] += 1
		x //= prime[x]
	return C
N = int(readline())
A = map(int, readline().split())
C = defaultdict(list)
Di = Counter()
if N == 2:
	ans = lcm(*A)
else:
	for a in A:
		pa = pd(a)
		for (k, v) in pa.items():
			res = C[k]
			res.append(v)
			res.sort()
			C[k] = res[:2]
			Di[k] += 1
	ans = 1
	for (k, v) in C.items():
		if Di[k] < N - 1:
			continue
		elif Di[k] == N - 1:
			ans *= pow(k, v[0])
		else:
			ans *= pow(k, v[1])
print(ans)


import sys
import math
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
ANS = dict()
x = A[0]
L = int(math.sqrt(x))
FACT = dict()
for i in range(2, L + 2):
	while x % i == 0:
		FACT[i] = FACT.get(i, 0) + 1
		x = x // i
if x != 1:
	FACT[x] = FACT.get(x, 0) + 1
for f in FACT:
	MIN0 = 1 << 30
	MIN1 = 1 << 30
	for a in A:
		count = 0
		while a % f == 0:
			a //= f
			count += 1
		if count <= MIN0:
			(MIN0, MIN1) = (count, MIN0)
		elif count <= MIN1:
			MIN1 = count
	ANS[f] = MIN1
x = A[1]
L = int(math.sqrt(x))
FACT = dict()
for i in range(2, L + 2):
	while x % i == 0:
		FACT[i] = FACT.get(i, 0) + 1
		x = x // i
if x != 1:
	FACT[x] = FACT.get(x, 0) + 1
for f in FACT:
	MIN0 = 1 << 30
	MIN1 = 1 << 30
	for a in A:
		count = 0
		while a % f == 0:
			a //= f
			count += 1
		if count <= MIN0:
			(MIN0, MIN1) = (count, MIN0)
		elif count <= MIN1:
			MIN1 = count
	ANS[f] = MIN1
A = 1
for a in ANS:
	A = A * a ** ANS[a]
print(A)


is_prime = [True] * 200001
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(201006 ** 0.5)):
	for j in range(i * i, 100001, i):
		is_prime[j] = False
pr = []
for i in range(len(is_prime)):
	if is_prime[i]:
		pr.append(i)
n = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(len(pr)):
	Min = 1000
	new_Min = 1000
	for j in range(len(A)):
		neo = 0
		while A[j] % pr[i] == 0 and neo < new_Min:
			neo += 1
			A[j] //= pr[i]
		if neo <= Min:
			(Min, new_Min) = (neo, Min)
		elif neo < new_Min:
			new_Min = neo
		if new_Min == 0:
			break
	ans *= pr[i] ** new_Min
print(ans)


def main():
	from array import array
	from collections import Counter
	from itertools import chain
	from math import gcd
	from sys import stdin, stdout
	n = int(stdin.readline())
	if n == 2:
		(a, b) = map(int, stdin.readline().split())
		print(a // gcd(a, b) * b)
		return
	a = array('i', map(int, stdin.readline().split()))
	ans = 1
	for p in range(2, 444):
		pows = [0] * n
		for i in range(n):
			while not a[i] % p:
				a[i] //= p
				pows[i] += 1
		pows.sort()
		ans *= p ** pows[1]
	cnt = Counter(a)
	nm1 = n - 1
	print(ans * next(chain((k for k in cnt.keys() if cnt[k] >= nm1), (1,))))
main()


from math import *
n = int(input())
a = (*map(int, input().split()),)
g = gcd(a[0], a[1])
l = a[0] * a[1] // g
for x in a[2:]:
	l = gcd(l, x * g // gcd(x, g))
	g = gcd(x, g)
print(l)


n = int(input())
As = list(map(int, input().split()))

def gcd(n, m):
	a = max(n, m)
	b = min(n, m)
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(n, m):
	return n * m // gcd(n, m)

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors
left = [As[0]]
right = [As[-1]]
for i in range(1, n):
	left.append(gcd(left[i - 1], As[i]))
	right.append(gcd(right[i - 1], As[-i - 1]))
right = right[::-1]
gcds = []
for i in range(n):
	if i == 0:
		gcds.append(right[1])
	elif i == n - 1:
		gcds.append(left[n - 2])
	else:
		l = gcd(left[i - 1], right[i + 1])
		gcds.append(l)
ans = gcds[0]
for g in gcds:
	ans = lcm(ans, g)
print(ans)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import defaultdict
from heapq import heappush, heapify, heappop
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(list)
n = I()
l = L()
g = l[0]
for i in range(1, n):
	g = mt.gcd(g, l[i])
	if g == 1:
		break
if g != 1:
	for i in range(n):
		l[i] //= g
for i in range(n):
	f = defaultdict(int)
	k = 2
	while l[i] != 1 and k < int(mt.sqrt(l[i]) + 1):
		ck = 0
		while l[i] % k == 0:
			f[k] += 1
			l[i] //= k
		k += 1
	if l[i] != 1:
		f[l[i]] += 1
	for j in f.keys():
		d[j].append(f[j])
		if len(d[j]) == n - 1:
			g *= pow(j, sorted(d[j])[0])
print(g)


from math import gcd
import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def get_primes(n):
	isp = [1] * n
	p = []
	for i in range(2, n):
		if isp[i]:
			isp[i] = 0
			p.append(i)
			for j in range(i * i, n, i):
				isp[j] = 1
	return p

def divs(x, primes):
	for p in primes:
		k = 0
		while x % p == 0:
			x //= p
			k += 1
		if k > 0:
			yield (p, k)
		if p > x:
			break
	if x > 1:
		yield (x, k)
	return

def main():
	primes = get_primes(2 * 10 ** 5)
	n = next(ints)
	a = [next(ints) for i in range(n)]
	m = {p: (50, 50) for p in primes}
	for x in a:
		pp = list(m)
		for p in pp:
			k = 0
			while x % p == 0:
				x //= p
				k += 1
			(a, b) = m[p]
			if k == 0 == a:
				del m[p]
			elif k <= a:
				m[p] = (k, a)
			elif k <= b:
				m[p] = (a, k)
	ans = 1
	for p in m:
		ans *= p ** m[p][1]
	print(ans)
	return
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
(n,) = I()
l = I()
g = l[0]
an = 1
d = dd(list)
for i in range(n):
	x = l[i]
	for j in range(2, int(x ** 0.5) + 1):
		ct = 0
		while x % j == 0:
			x //= j
			ct += 1
		if ct != 0:
			d[j].append(ct)
		if x == 1:
			break
	if x != 1:
		d[x].append(1)
for i in d:
	if len(d[i]) == n - 1:
		an *= pow(i, min(d[i]))
	elif len(d[i]) == n:
		d[i].remove(min(d[i]))
		an *= pow(i, min(d[i]))
print(an)


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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
pre = [0] * n
suf = [0] * n
(pre[0], suf[n - 1]) = (a[0], a[n - 1])
for i in range(1, n):
	pre[i] = gcd(pre[i - 1], a[i])
for i in range(n - 2, -1, -1):
	suf[i] = gcd(suf[i + 1], a[i])
ans = 1
for i in range(n):
	if i == 0:
		ans = lcm(ans, suf[1])
	elif i == n - 1:
		ans = lcm(ans, pre[n - 2])
	else:
		ans = lcm(ans, gcd(pre[i - 1], suf[i + 1]))
print(ans)


def prime_list(n):
	a = list(range(n + 1))
	a[1] = 0
	lst = []
	i = 2
	while i <= n:
		if a[i] != 0:
			lst.append(a[i])
			for j in range(i, n + 1, i):
				a[j] = 0
		i += 1
	del a
	return lst

def isdiv(a, b):
	c = a
	d = b
	res = 0
	while c % d == 0:
		c = c // d
		res += 1
	return res
n = int(input())
a = [int(i) for i in input().split()]
lst = prime_list(int(max(a)))
div = 1
for prime in lst:
	isdiv_min = 10 ** 7
	isdiv_min2 = 10 ** 7
	count = 0
	res = 0
	for i in range(n):
		res = isdiv(a[i], prime)
		if res == 0:
			count += 1
		if count > 1:
			break
		if res < isdiv_min:
			isdiv_min2 = isdiv_min
			isdiv_min = res
		elif res >= isdiv_min and res < isdiv_min2:
			isdiv_min2 = res
	if count <= 1:
		div = div * prime ** isdiv_min2
print(div)


LIM = 2 * 10 ** 5 + 5
sie = [1 for i in range(LIM)]
sie[0] = 1
sie[1] = 1
spf = [i for i in range(LIM)]
for i in range(2, LIM):
	if sie[i]:
		for j in range(2 * i, LIM, i):
			sie[j] = 0
			spf[j] = i
primes = [i for i in range(2, len(sie)) if sie[i] == 1]
pwrs = dict()
n = int(input())
A = [int(i) for i in input().split()]
pwrs[1] = [1 for i in range(n)]
for i in range(len(A)):
	cp = A[i]
	while cp > 1:
		cnt = 0
		smolpf = spf[cp]
		while smolpf != 1 and cp % smolpf == 0:
			cp = cp // smolpf
			cnt += 1
		if smolpf not in pwrs:
			pwrs[smolpf] = [cnt]
		else:
			pwrs[smolpf].append(cnt)
ans = 1
for i in pwrs:
	pwrs[i].sort()
for i in pwrs:
	if len(pwrs[i]) == n:
		ans *= i ** pwrs[i][1]
	elif len(pwrs[i]) == n - 1:
		ans *= i ** pwrs[i][0]
print(ans)


from math import *
n = int(input())
a = [int(i) for i in input().split()]
INF = 1000000
d = {}
for i in range(n):
	div = 2
	s = a[i]
	while div * div <= a[i]:
		cnt = 0
		while s % div == 0:
			s //= div
			cnt += 1
		if cnt > 0:
			if div not in d:
				d[div] = []
			d[div].append(cnt)
		div += 1
	if s > 1:
		if s not in d:
			d[s] = []
		d[s].append(1)
ans = 1
for i in d:
	if len(d[i]) >= n - 1:
		mi1 = INF
		mi2 = INF
		for x in d[i]:
			if x <= mi1:
				mi2 = mi1
				mi1 = x
			elif x <= mi2:
				mi2 = x
		if mi2 < INF and len(d[i]) == n:
			ans *= i ** mi2
		else:
			ans *= i ** mi1
print(ans)


(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, dgraphs, mod) = (lambda : sorted(zz()), {}, 10 ** 9 + 7)
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
n = int(z())
l = szz()
ans = l[0] * l[1] // gcd(l[0], l[1])
g = gcd(l[0], l[1])
for i in l[2:]:
	g1 = gcd(i, g)
	ans = gcd(ans, i * g // g1)
	g = g1
print(ans)


import math

def solve(data, size):
	result = [0] * size
	result[-1] = data[-1]
	for i in range(size - 2, -1, -1):
		result[i] = math.gcd(result[i + 1], data[i])
	for i in range(size - 1):
		result[i] = data[i] * result[i + 1] // math.gcd(data[i], result[i + 1])
	result.pop()
	ans = result[0]
	for i in range(1, len(result)):
		ans = math.gcd(ans, result[i])
	return ans
size = int(input())
data = list(map(int, input().split()))
print(solve(data, size))


import sys
input = sys.stdin.readline

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = int(input())
l = list(map(int, input().split()))
gcdarr = find_gcd(l[0], l[1])
for i in range(2, n):
	gcdarr = find_gcd(gcdarr, l[i])
for i in range(n):
	l[i] = l[i] // gcdarr
prefix = [1] * n
suffix = [1] * n
prefix[0] = l[0]
suffix[n - 1] = l[n - 1]
for i in range(1, n):
	prefix[i] = find_gcd(prefix[i - 1], l[i])
for i in range(n - 2, -1, -1):
	suffix[i] = find_gcd(suffix[i + 1], l[i])
arr = []
for i in range(n):
	if i == 0:
		arr.append(suffix[i + 1])
	elif i == n - 1:
		arr.append(prefix[i - 1])
	else:
		arr.append(find_gcd(prefix[i - 1], suffix[i + 1]))
prod = 1
for i in arr:
	prod *= i
print(prod * gcdarr)


t = 1

def gcd(x, y):
	if x < y:
		temp = x
		x = y
		y = temp
	if x % y == 0:
		return y
	return gcd(x % y, y)

def fn():
	n = int(input())
	a = list(map(int, input().split()))
	last = [0] * n
	last[n - 1] = a[n - 1]
	for i in range(n - 2, -1, -1):
		last[i] = gcd(last[i + 1], a[i])
	all = list()
	for i in range(n - 2, -1, -1):
		z = a[i] * last[i + 1] // gcd(a[i], last[i + 1])
		all.append(z)
	ans = all[0]
	for i in range(n - 1):
		ans = gcd(ans, all[i])
	print(ans)
while t:
	t -= 1
	fn()


from collections import defaultdict
N = 2 * 10 ** 5 + 1

def fast_power(a, b):
	power = 1
	while b:
		if b & 1:
			power *= a
		a *= a
		b >>= 1
	return power

def pp():
	spf = [i for i in range(N)]
	i = 2
	while i * i < N:
		if spf[i] == i:
			j = 2
			while i * j < N:
				spf[i * j] = min(i, spf[i * j])
				j += 1
		i += 1
	return spf

def f(num, ma, spf):
	cnt = {}
	while num > 1:
		cnt[spf[num]] = cnt.get(spf[num], 0) + 1
		num //= spf[num]
	for key in cnt:
		ma[key].append(cnt[key])

def main():
	spf = pp()
	n = int(input())
	arr = list(map(int, input().strip().split()))
	if n == 1:
		print(arr[0])
		return
	ma = defaultdict(list)
	for num in arr:
		f(num, ma, spf)
	ret = 1
	for key in ma:
		if len(ma[key]) < n - 1:
			continue
		ma[key].sort()
		if len(ma[key]) == n - 1:
			ret *= fast_power(key, ma[key][0])
		else:
			ret *= fast_power(key, ma[key][1])
	print(ret)
main()


class Sieve:

	def __init__(self, n):
		f = [0] * (n + 1)
		primes = list()
		f[0] = f[1] = -1
		for i in range(2, n + 1):
			if f[i]:
				continue
			primes.append(i)
			f[i] = i
			for j in range(i * i, n + 1, i):
				if not f[j]:
					f[j] = i
		self.f = f
		self.primes = primes

	def isPrime(self, x):
		return self.f[x] == x

	def factorList(self, x):
		res = list()
		while x > 1:
			res.append(self.f[x])
			x //= self.f[x]
		return res

	def factor(self, x):
		fl = self.factorList(x)
		if len(fl) == 0:
			return list()
		res = [[fl[0], 0]]
		for p in fl:
			if res[-1][0] == p:
				res[-1][1] += 1
			else:
				res.append([p, 1])
		return res
sv = Sieve(200005)
n = int(input())
a = list(map(int, input().split()))
ans = dict()
INF = 1001001001
primes = set()
for i in range(n):
	f = sv.factor(a[i])
	for (p, cnt) in f:
		try:
			ls = ans[p]
			if ls[0] > cnt:
				ls = [cnt, ls[0], ls[2] + 1]
			elif ls[1] > cnt:
				ls = [ls[0], cnt, ls[2] + 1]
			else:
				ls[2] += 1
			ans[p] = ls
		except:
			ans[p] = [cnt, INF, 1]
g = 1
for (p, ls) in ans.items():
	if ls[2] < n - 1:
		continue
	elif ls[2] == n - 1:
		g *= p ** ls[0]
	else:
		g *= p ** ls[1]
print(g)


def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a >= b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
n = int(input())
arr = list(map(int, input().split()))
gcdList = [1] * n
gcdList[-1] = arr[-1]
for i in range(n - 2, -1, -1):
	gcdList[i] = gcd(arr[i], gcdList[i + 1])
ans = [0] * (n - 1)
for i in range(n - 1):
	ans[i] = arr[i] * gcdList[i + 1] // gcdList[i]
solution = ans[0]
for i in range(1, n - 1, 1):
	solution = gcd(solution, ans[i])
print(solution)


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def nextPrime(N):
	if N <= 1:
		return 2
	prime = N
	found = False
	while not found:
		prime = prime + 1
		if isPrime(prime) == True:
			found = True
	return prime
n = inputnum()
a = inputlist()
a.sort()
p = 2
ans = 1
while a[1] > 1 and p <= a[1]:
	count = 0
	for i in range(n):
		if a[i] % p != 0 or a[i] < p:
			count += 1
			if count == 2:
				break
	if count > 1:
		p = nextPrime(p)
	else:
		ans *= p
		for j in range(n):
			if a[j] >= p and a[j] % p == 0:
				a[j] //= p
		a.sort()
print(ans)


from collections import defaultdict
from functools import reduce
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def solve(arr):
	n = len(arr)
	freq = defaultdict(int)
	for ele in arr:
		facs = factors(ele)
		for fac in facs:
			freq[fac] += 1
	ans = []
	for key in freq:
		if freq[key] >= n - 1:
			ans.append(key)
	return reduce(lcm, ans)

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr))
main()


def gcd(b, a):
	if a == 0:
		return b
	return gcd(a, b % a)
N = int(input())
n = list(map(int, input().split()))
suf = n[:]
for z in range(N - 2, -1, -1):
	suf[z] = gcd(max(n[z], suf[z + 1]), min(n[z], suf[z + 1]))
hcf = []
for w in range(N - 1):
	hcf.append(n[w] * suf[w + 1] // gcd(max(n[w], suf[w + 1]), min(n[w], suf[w + 1])))
ans = hcf[0]
for u in range(1, len(hcf)):
	ans = gcd(max(ans, hcf[u]), min(ans, hcf[u]))
print(ans)


def inp():
	return int(input())

def inlt():
	l = input().split()
	for i in range(len(l)):
		l[i] = int(l[i])
	return l

def insr():
	s = input()
	return list(s[:len(s)])

def s_to_int(a):
	for i in range(len(a)):
		a[i] = int(a[i])

def factors(n):
	res = []
	t = 1
	while t * t <= n:
		if t * t == n:
			res.append(t)
		if n % t == 0:
			res.append(t)
			res.append(n // t)
		t += 1
	res.sort()
	return res

def compact_factors(n):
	res = []
	t = 2
	while n != 1 and t * t <= n:
		cnt = 0
		while n % t == 0:
			cnt += 1
			n //= t
		if cnt != 0:
			res.append([t, cnt])
		t += 1
	if n > 1:
		res.append([n, 1])
	return res

def binary_search(l, target, lp, rp):
	mid = (lp + rp) // 2
	if l[mid] == target:
		return mid
	elif l[mid] > target:
		binary_search(l, target, lp, mid - 1)
	elif l[mid] < target:
		binary_search(l, target, mid + 1, rp)
	elif lp >= rp:
		return -1
n = inp()
l = inlt()
prime_factors = {}
for x in l:
	f = compact_factors(x)
	for y in f:
		if y[0] not in prime_factors:
			prime_factors[y[0]] = [y[1]]
		else:
			prime_factors[y[0]].append(y[1])
res = 1
for x in prime_factors:
	if len(prime_factors[x]) == n:
		prime_factors[x].remove(min(prime_factors[x]))
		res *= x ** min(prime_factors[x])
	elif len(prime_factors[x]) == n - 1:
		res *= x ** min(prime_factors[x])
print(res)


primes = []

def sieve(n):
	marked = [True for i in range(n + 4)]
	p = 2
	while p * p <= n:
		if marked[p] == True:
			for i in range(p * p, n + 1, p):
				marked[i] = False
		p += 1
	for p in range(2, n + 1):
		if marked[p]:
			primes.append(p)

def get_result(arr):
	res = 1
	for p in primes:
		now = []
		zeros = 0
		for i in range(len(arr)):
			cnt = 0
			while arr[i] % p == 0:
				arr[i] /= p
				cnt += 1
			if cnt == 0:
				zeros += 1
			now.append(cnt)
			if zeros == 2:
				break
		if zeros == 2:
			continue
		now.sort()
		mx = max(now[0], now[1])
		res *= p ** mx
	return res
sieve(200000)
n = input()
arr = list(map(int, input().split()))
print(get_result(arr))


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = [i for i in map(int, input().split(' '))]
g = []
s = 0
for i in reversed(a):
	s = gcd(s, i)
	g.append(s)
g.reverse()
ans = 0
for i in range(n - 1):
	ans = gcd(ans, lcm(a[i], g[i + 1]))
print(ans)


def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a
n = int(input())
l = list(map(int, input().split()))
if n == 1:
	print(l[0])
else:
	g = gcd(l[0], l[1])
	a = l[0] * l[1] // g
	for i in range(2, n):
		(a, g) = (gcd(a, g * l[i] // gcd(g, l[i])), gcd(l[i], g))
	print(a)


from collections import defaultdict, Counter
import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			pass

def computeGCD(x, y):
	if x > y:
		small = y
	else:
		small = x
	for i in range(1, small + 1):
		if x % i == 0 and y % i == 0:
			gcd = i
	return gcd

def helper(n):
	cnt = 0
	d = defaultdict(int)
	while (n % 2 > 0) == False:
		n >>= 1
		cnt += 1
	if cnt > 0:
		d[2] = cnt
	for i in range(3, int(math.sqrt(n)) + 1):
		cnt = 0
		while n % i == 0:
			cnt += 1
			n = int(n / i)
		if cnt > 0:
			d[i] += cnt
		i += 2
	if n > 2:
		d[n] = 1
	return d
n = int(input())
lst = list(map(int, input().split()))
d1 = defaultdict(int)
d2 = defaultdict(list)
for i in lst:
	d = helper(i)
	for j in d:
		d1[j] += 1
		d2[j].append(d[j])
res = 1
for i in d1:
	if d1[i] == n:
		d2[i].sort()
		res *= i ** d2[i][1]
	elif d1[i] == n - 1:
		res *= i ** min(d2[i])
print(res)


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())
t = 1

def lcm(p, q):
	return p * q // gcd(p, q)

def gcda(a):
	g = a[0]
	for i in range(1, len(a)):
		g = gcd(g, a[i])
	return g
MAXN = 2 * 10 ** 5 + 10
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fact(x):
	ret = {}
	while x != 1:
		if spf[x] not in ret:
			ret[spf[x]] = 1
		else:
			ret[spf[x]] += 1
		x = x // spf[x]
	return ret
t = 1

def vul(n):
	pp = []
	for i in range(n):
		for j in range(i + 1, n):
			pp.append(lcm(a[i], a[j]))
	print(gcda(pp))
sieve()
while t > 0:
	t -= 1
	n = fi()
	a = li()
	d = [[] for i in range(2 * 10 ** 5 + 11)]
	for i in a:
		f = fact(i)
		for j in f:
			d[j].append(f[j])
	c = 1
	for i in range(len(d)):
		if len(d[i]) == n - 1:
			c *= i ** min(d[i])
		elif len(d[i]) == n:
			d[i].sort()
			c *= i ** d[i][1]
	print(c)


n = int(input())
p = []

def getn(i, num):
	ret = 0
	while i % num != 0:
		ret += 1
		i //= num
	return ret
Div = {i + 1: 0 for i in range(199999)}

def check(num):
	for i in range(2, int(num ** 0.5) + 1):
		if num % i == 0:
			return False
	return True
for i in range(2, 1000):
	if check(i):
		p.append(i)
a = list(map(int, input().split()))
for i in range(len(p)):
	secondmin = -1
	Min = -1
	for j in range(n):
		cnt = 0
		while a[j] % p[i] == 0:
			cnt += 1
			a[j] //= p[i]
		if Min == -1:
			Min = cnt
		elif secondmin == -1:
			if cnt < Min:
				secondmin = Min
				Min = cnt
			else:
				secondmin = cnt
		elif Min < cnt <= secondmin:
			secondmin = cnt
		elif cnt <= Min:
			secondmin = Min
			Min = cnt
	Div[p[i]] = max(0, secondmin)
visited = [0] * 200001
for i in a:
	visited[i] += 1
ans = 1
for i in range(2, 200001):
	if visited[i] >= n - 1:
		ans *= i
for i in range(len(p)):
	ans *= p[i] ** Div[p[i]]
print(ans)


import math
from math import gcd

def r():
	return map(int, input().split())

def l():
	return list(map(int, input().split()))

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = int(input())
li = l()
g = gcd(li[0], li[1])
a = li[0] * li[1] // gcd(li[0], li[1])
for i in range(2, t):
	a = gcd(a, li[i] * g // gcd(li[i], g))
	g = gcd(g, li[i])
print(a)


import math
n = int(input())
a = [int(i) for i in input().split()]
g = 0
for i in range(n):
	g = math.gcd(g, a[i])
for i in range(n):
	a[i] //= g
pre = [0] * (n + 1)
suff = [0] * (n + 1)
pre[0] = a[0]
suff[n - 1] = a[n - 1]
for i in range(1, n):
	pre[i] = math.gcd(pre[i - 1], a[i])
for i in range(n - 2, -1, -1):
	suff[i] = math.gcd(suff[i + 1], a[i])
for i in range(n):
	if i == 0:
		g *= suff[i + 1]
	elif i == n - 1:
		g *= pre[i - 1]
	else:
		g *= math.gcd(pre[i - 1], suff[i + 1])
print(g)


import math
import sys
n = int(input())
arr = [int(x) for x in sys.stdin.readline().split(' ')]
g = [arr[0]]
for i in range(1, len(arr)):
	g.append(math.gcd(arr[i], g[-1]))
temp = []
for i in range(1, len(arr)):
	temp.append(g[i - 1] * arr[i] // math.gcd(g[i - 1], arr[i]))
ans = temp[0]
for a in temp:
	ans = math.gcd(a, ans)
print(ans)


import math

def primeFactors(n):
	d1 = {}
	while n % 2 == 0:
		if 2 in d1:
			d1[2] += 1
		else:
			d1[2] = 1
		n //= 2
	x = n
	for i in range(3, int(math.sqrt(x)) + 1, 2):
		while n % i == 0:
			if i in d1:
				d1[i] += 1
			else:
				d1[i] = 1
			n = n // i
	if n > 2:
		d1[n] = 1
	return d1
n = int(input())
a = list(map(int, input().split()))
if n == 2:
	print(a[0] * a[1] // math.gcd(a[0], a[1]))
else:
	d = {}
	sech = {}
	l = [-1 for i in range(2 * 10 ** 6)]
	for j in a:
		if l[j - 1] != -1:
			d1 = l[j - 1]
		else:
			d1 = primeFactors(j)
			l[j - 1] = d1
		for i in d1:
			if i not in d:
				d[i] = 1
				sech[i] = [-1, d1[i]]
			else:
				d[i] += 1
				if sech[i][0] == -1:
					r = sech[i][1]
					sech[i][0] = min(r, d1[i])
					sech[i][1] = max(r, d1[i])
				elif d1[i] < sech[i][0]:
					sech[i][1] = sech[i][0]
					sech[i][0] = d1[i]
				elif d1[i] == sech[i][0]:
					sech[i][1] = d1[i]
				elif d1[i] < sech[i][1]:
					sech[i][1] = d1[i]
	ans = 1
	for i in d:
		if d[i] == n:
			ans *= i ** sech[i][1]
		elif d[i] == n - 1:
			ans *= i ** sech[i][0]
	print(int(ans))


from math import *
e = []

def lcm(a, b):
	lm = a * b // gcd(a, b)
	e.append(lm)
	return lm
x = int(input())
a = list(map(int, input().split()))
j = 0
for i in a:
	u = lcm(j, i)
	j = gcd(j, i)
b = e[0]
for j in range(1, len(e)):
	s = gcd(b, e[j])
	b = s
print(b)


import math
try:
	math.isqrt
except AttributeError:

	def isqrt(n):
		return math.floor(math.sqrt(n))
	math.isqrt = isqrt
else:
	from math import isqrt
_isprime = [False, False, True, True, False, True]

def _extend_isprime(n):
	i = len(_isprime)
	if n <= i:
		return
	_isprime.extend((True for _ in range(n - i)))
	for x in range(2, isqrt(n - 1) + 1):
		if _isprime[x]:
			for mx in range(max(2, math.ceil(i / x)) * x, n, x):
				_isprime[mx] = False

def primes(n: int):
	_extend_isprime(n)
	isprime = _isprime
	for x in range(2, n):
		if isprime[x]:
			yield x

def is_prime(n: int):
	_extend_isprime(n + 1)
	return _isprime[n]
import sys

def input(itr=iter(sys.stdin.readlines())):
	return next(itr).rstrip('\n\r')
import math as m
import collections
all_factors = list(primes(200000 + 1))
n = int(input())
a = list(map(int, input().split()))

def factor_count(x, fs=all_factors):
	c = collections.Counter()
	for f in fs:
		q = x
		while True:
			(q, r) = divmod(q, f)
			if r == 0:
				c[f] += 1
			else:
				break
	return c
ans_factors = {f: [m.inf, m.inf] for f in all_factors}
for x in a:
	c = factor_count(x, ans_factors)
	for f in list(ans_factors):
		ans_factors[f].append(c[f])
		ans_factors[f].sort()
		if ans_factors[f][1] == 0:
			del ans_factors[f]
		else:
			del ans_factors[f][2]
answer = 1
for (f, p) in ans_factors.items():
	answer *= f ** p[1]
print(answer)


from math import gcd
from functools import reduce

def find_gcd(list):
	x = reduce(gcd, list)
	return x
n = int(input())
arr = [int(_) for _ in input().split()]
ans = []
gcd_suff = [0] * n
gcd_suff[-1] = arr[-1]
i = n - 2
while i >= 0:
	gcd_suff[i] = gcd(arr[i], gcd_suff[i + 1])
	i -= 1
i = 0
while i < n - 1:
	ans.append(arr[i] * gcd_suff[i + 1] // gcd(arr[i], gcd_suff[i + 1]))
	i += 1
print(find_gcd(ans))


from collections import Counter
from math import ceil, sqrt
from sys import stdin
input = stdin.readline

def sieve(n):
	sqrtn = ceil(sqrt(n))
	prime = [True for _ in range(n + 1)]
	p = 2
	while p <= sqrtn:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return [i for (i, x) in enumerate(prime) if x]
lim = 2 * 10 ** 5
primes = sieve(lim)
sprimes = set(primes)
n = int(input())
arr = list(map(int, input().split()))
narr = []
for x in arr:
	if x in sprimes:
		narr.append((x, 1))
		continue
	for p in primes:
		if p > x:
			break
		if not x % p:
			pl = 1
			while not x % p ** pl:
				narr.append((p, pl))
				pl += 1
			x //= p ** (pl - 1)
cnt = Counter(narr)
l = list(sorted(map(lambda o: o[0], filter(lambda o: o[1] > n - 2, cnt.most_common())), key=lambda x: (x[0], x[1])))
ml = 1
for i in range(1, len(l)):
	if l[i][0] != l[i - 1][0]:
		ml *= l[i - 1][0] ** l[i - 1][1]
	if i == len(l) - 1:
		ml *= l[i][0] ** l[i][1]
if len(l) == 1:
	print(l[0][0])
else:
	print(ml)


import math

def LCM(a, b):
	return a * b // math.gcd(a, b)
n = int(input())
arr = list(map(int, input().split()))
suffix_arr = [1] * n
suffix_arr[-1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	suffix_arr[i] = math.gcd(arr[i], suffix_arr[i + 1])
ans = LCM(arr[0], suffix_arr[1])
for i in range(1, n - 1):
	ans = math.gcd(ans, LCM(arr[i], suffix_arr[i + 1]))
print(ans)


from sys import stdin
from collections import defaultdict

def get_prime_nums():
	prime_nums = [2]
	for i in range(3, 500):
		is_prime = True
		for num in prime_nums:
			if i % num == 0:
				is_prime = False
				break
		if is_prime:
			prime_nums.append(i)
	return prime_nums
n = int(stdin.buffer.readline())
input_nums = [int(_) for _ in stdin.buffer.readline().split()]
prime_nums = get_prime_nums()
prime_stats = defaultdict(lambda : [0] * 20)
for input_num in input_nums:
	for prime_num in prime_nums:
		power = 1
		while input_num % prime_num == 0:
			prime_stats[prime_num][power] += 1
			power += 1
			input_num = input_num // prime_num
	if input_num != 1:
		prime_stats[input_num][1] += 1
ans = 1
for (prime_num, stat) in prime_stats.items():
	i = 0
	while stat[i + 1] >= n - 1:
		i += 1
	ans *= prime_num ** i
print(ans)


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(n,) = Neo()
arr = Neo()
g = math.gcd(arr[0], arr[1])
s = arr[0] * arr[1] // g
for i in arr[2:]:
	s = math.gcd(s, i * g // math.gcd(g, i))
	g = math.gcd(g, i)
print(s)


import sys
import math as m
n = int(input())
l = list(map(int, input().split()))
suffix = [l[-1]] * n
for i in range(n - 2, 0, -1):
	suffix[i] = m.gcd(l[i], suffix[i + 1])
cur = [0] * n
for i in range(n - 1):
	cur[i] = l[i] * suffix[i + 1] // m.gcd(l[i], suffix[i + 1])
ans = cur[0]
for i in range(1, n - 1):
	ans = m.gcd(ans, cur[i])
print(ans)


import sys
input = sys.stdin.readline
from collections import *

def factorize(n):
	fct = []
	for i in range(2, int(n ** 0.5) + 1):
		c = 0
		while n % i == 0:
			n //= i
			c += 1
		if c > 0:
			fct.append((i, c))
	if n > 1:
		fct.append((n, 1))
	return fct
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(list)
for ai in a:
	fct = factorize(ai)
	for (p, c) in fct:
		d[p].append(c)
for k in d:
	d[k].sort()
ans = 1
for k in d:
	if len(d[k]) <= n - 2:
		continue
	if len(d[k]) == n - 1:
		ans *= k ** d[k][0]
	else:
		ans *= k ** d[k][1]
print(ans)


def gcd(a, b):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)
n = int(input())
a = list(map(int, input().split()))
b = a[-1]
c = []
for i in range(n - 2, -1, -1):
	c.append(b * a[i] // gcd(b, a[i]))
	b = gcd(b, a[i])
b = 0
for i in range(len(c)):
	b = gcd(b, c[i])
print(b)


import os
import sys
from io import BytesIO, IOBase
from math import gcd

def seive():
	num = int(2 * 100000.0 + 11)
	l = [i for i in range(num)]
	for i in range(2, num):
		if l[i] == i:
			for j in range(i ** 2, num, i):
				l[j] = i
	return l

def main():
	n = int(input())
	l = [int(j) for j in input().split()]
	ls = [dict() for i in range(n)]
	glob_set = dict()
	gc = l[0]
	for i in range(1, n):
		gc = gcd(gc, l[i])
	spf = seive()
	for i in range(n):
		d = ls[i]
		m = l[i] // gc
		while m > 1:
			pf = spf[m]
			if pf in d:
				d[pf] += 1
			else:
				d[pf] = 1
			m = m // pf
		for key in d:
			if key not in glob_set:
				glob_set[key] = [d[key], 1]
			else:
				glob_set[key][0] = min(d[key], glob_set[key][0])
				glob_set[key][1] += 1
	ans = 1
	for div in glob_set:
		if glob_set[div][1] >= len(l) - 1:
			ans = ans * div ** glob_set[div][0]
	print(ans * gc)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
N = int(input())
s = [int(x) for x in input().split()]
L = []
for i in range(max(s) + 10):
	h = []
	L.append(h)
for i in range(0, len(s)):
	n = s[i]
	c = 0
	while n % 2 == 0:
		c += 1
		n = n // 2
	if c != 0:
		L[2].append(c)
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		c = 0
		while n % i == 0:
			c += 1
			n = n // i
		if c != 0:
			L[i].append(c)
	if n > 2:
		L[n].append(1)
ans = 1
for i in range(0, len(L)):
	if len(L[i]) == N - 1:
		ans *= i ** min(L[i])
	elif len(L[i]) == N:
		tt1 = min(L[i][0], L[i][1])
		tt2 = max(L[i][0], L[i][1])
		for j in range(2, len(L[i])):
			if L[i][j] < tt1:
				tt2 = tt1
				tt1 = L[i][j]
			elif L[i][j] < tt2:
				tt2 = L[i][j]
		ans *= i ** tt2
print(ans)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def factorization(n):
	arr = defaultdict(int)
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			arr[i] = cnt
	if temp != 1:
		arr[temp] = 1
	if arr == []:
		arr[n] = 1
	return arr

def solve():
	N = Scanner.int()
	A = Scanner.map_int()
	S = defaultdict(list)
	for i in range(N):
		D = factorization(A[i])
		for (k, v) in D.items():
			S[k].append(v)
	ans = 1
	for (k, v) in S.items():
		a = sorted(v)
		if len(a) == N:
			t = a[1]
		elif len(a) + 1 == N:
			t = a[0]
		else:
			t = 0
		ans *= k ** t
	print(ans)

def main():
	solve()
main()


from collections import Counter as C
nn = 200000
X = [-1] * (nn + 1)
L = [[] for _ in range(nn + 1)]
k = 2
while k <= nn:
	X[k] = 1
	L[k].append(k)
	for i in range(k * 2, nn + 1, k):
		X[i] = 0
		L[i].append(k)
	d = 2
	while k ** d <= nn:
		for i in range(k ** d, nn + 1, k ** d):
			L[i].append(k)
		d += 1
	while k <= nn and X[k] >= 0:
		k += 1

def second(L):
	mi1 = 100
	mi2 = 100
	for a in L:
		if a < mi1:
			mi2 = mi1
			mi1 = a
		elif a < mi2:
			mi2 = a
	return mi2
N = int(input())
A = [int(a) for a in input().split()]
S = set()
for a in A:
	for p in L[a]:
		S.add(p)
D = {s: [] for s in S}
for a in A:
	c = C(L[a])
	for p in c:
		D[p].append(c[p])
ans = 1
for p in D:
	if len(D[p]) == N - 1:
		ans *= p ** min(D[p])
	elif len(D[p]) == N:
		ans *= p ** second(D[p])
print(ans)


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.readline

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

	def lcm(a, b):
		return a * b // gcd(a, b)
	N = int(input())
	A = list(map(int, input().split()))
	left = [0] * (N + 1)
	right = [0] * (N + 1)
	for (i, a) in enumerate(A):
		left[i + 1] = gcd(left[i], a)
	for i in range(N - 1, -1, -1):
		right[i] = gcd(right[i + 1], A[i])
	ans = 0
	for i in range(N):
		ans = gcd(ans, lcm(gcd(left[i], right[i + 1]), A[i]))
	print(ans)
main()


def gcd(a, b):
	if a == 0:
		return b
	if b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
n = int(input())
li = [int(x) for x in input().split()]
gcd_suffix = [0] * n
gcd_suffix[n - 1] = li[n - 1]
iterator = li[n - 1]
for i in range(n - 2, -1, -1):
	iterator = gcd(iterator, li[i])
	gcd_suffix[i] = iterator
for i in range(n - 1):
	val = int(li[i] * gcd_suffix[i + 1] / gcd_suffix[i])
	if i == 0:
		final_gcd = val
	else:
		final_gcd = gcd(final_gcd, val)
print(final_gcd)


def lcm(a):
	lcm = a[0] * a[1] // gcd(a[0], a[1])
	for i in a[2:]:
		lcm = lcm * i // gcd(lcm, i)
	return lcm
from math import gcd, inf
n = int(input())
a = [int(i) for i in input().split()]
pref = [a[0]]
suf = [1] * (n - 1) + [a[-1]]
for i in a[1:]:
	pref.append(gcd(pref[-1], i))
for i in range(n - 2, -1, -1):
	suf[i] = gcd(a[i], suf[i + 1])
gcdd = [suf[1]]
for i in range(1, n - 1):
	gcdd.append(gcd(pref[i - 1], suf[i + 1]))
gcdd.append(pref[-2])
print(lcm(gcdd))


import math
inf = 100
maxn = 2 * 10 ** 5 + 100
n = int(input())
a = list(map(int, input().split()))
have = [[inf] * 2 for i in range(maxn)]
cnt = [0] * maxn
for i in range(0, n):
	j = 1
	while j * j <= a[i]:
		j += 1
		if a[i] % j != 0:
			continue
		cnt[j] += 1
		now = 0
		while a[i] % j == 0:
			now += 1
			a[i] //= j
		if have[j][0] > now:
			have[j][1] = have[j][0]
			have[j][0] = now
		elif have[j][1] > now:
			have[j][1] = now
	if a[i] != 1:
		cnt[a[i]] += 1
		now = 1
		if have[a[i]][0] > now:
			have[a[i]][1] = have[a[i]][0]
			have[a[i]][0] = now
		elif have[a[i]][1] > now:
			have[a[i]][1] = now
ans = 1
for i in range(2, maxn):
	if cnt[i] < n - 1:
		continue
	if cnt[i] == n:
		for j in range(have[i][1]):
			ans *= i
	if cnt[i] == n - 1:
		for j in range(have[i][0]):
			ans *= i
print(ans)


def readInt():
	return int(input())

def readList():
	return list(map(int, input().rstrip().split()))

def readString():
	s = input()
	return s

def readInts():
	return map(int, input().rstrip().split())
from math import gcd
gcd_memo = {}

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(n, s):
	gcds = [None] * n
	g = arr[-1]
	gcds[-1] = g
	for i in range(n - 2, -1, -1):
		g = gcd(g, arr[i])
		gcds[i] = g
	res = None
	for i in range(n - 1):
		if not res:
			res = lcm(arr[i], gcds[i + 1])
		else:
			res = gcd(res, lcm(arr[i], gcds[i + 1]))
	print(res)
n = readInt()
arr = readList()
solve(n, arr)


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(n, base=2):
	rt = []
	for tb in range(base ** n):
		s = [tb // base ** bt % base for bt in range(n)]
		rt += [s]
	return rt

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

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(1, 0), (-1, 0), (0, 1), (0, -1)]
EightNb = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('EWNS', FourNb))
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, ls=None, init=True, index=0):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			if ls == None:
				self.stdin(inp_size, index=index)
			else:
				self.size = len(ls) + 1
				(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.size = int(input())
		else:
			self.size = inp_size
		(self.edges, _) = GI(self.size, self.size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.size = len(ls) + 1
		(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def __str__(self):
		return str(self.edges)

	def dfs(self, x, func=lambda prv, nx, dist: prv + dist, root_v=0):
		q = deque()
		q.append(x)
		v = [-1] * self.size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == -1:
					q.append(nb)
					v[nb] = func(v[c], nb, d)
		return v

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.size
		self.ETout = [-1] * self.size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][r - (1 << N)])

	def query_id(self, l, r):
		if r > self.size:
			r = self.size
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][r - (1 << N)])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][r - (1 << N)]):
			b = a
		return b

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)

class Comb:

	def __init__(self, n, mo=10 ** 9 + 7):
		self.fac = [0] * (n + 1)
		self.inv = [1] * (n + 1)
		self.fac[0] = 1
		self.fact(n)
		for i in range(1, n + 1):
			self.fac[i] = i * self.fac[i - 1] % mo
			self.inv[n] *= i
			self.inv[n] %= mo
		self.inv[n] = pow(self.inv[n], mo - 2, mo)
		for i in range(1, n):
			self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
		return

	def fact(self, n):
		return self.fac[n]

	def invf(self, n):
		return self.inv[n]

	def comb(self, x, y):
		if y < 0 or y > x:
			return 0
		return self.fac[x] * self.inv[x - y] * self.inv[y] % mo
show_flg = False
show_flg = True
ans = 0
ans = 0
n = I()
a = LI()
G = a[0]
for i in range(n):
	G = gcd(G, a[i])
a = [i // G for i in a]
L = [0]
R = [0]
for i in range(n):
	L += [gcd(L[-1], a[i])]
	R += [gcd(R[-1], a[n - 1 - i])]
R = R[::-1]
ans = G
for i in range(n):
	gi = gcd(L[i], R[i + 1])
	ans *= gi
print(ans)


n = 200005
prime = [0] + [1] * n
small = [0] + [1] * n
for i in range(2, n + 1):
	if prime[i] == 1:
		small[i] = i
		for j in range(i * 2, n + 1, i):
			if prime[j] == 1:
				prime[j] = 0
				small[j] = i
nu = int(input())
ar = list(map(int, input().split()))
primear = {}
dic1 = {}
dic2 = {}
se = set({})
for j in range(2):
	dic = {}
	num = ar[j]
	pr = small[num]
	if pr in dic:
		dic[pr] += 1
	else:
		dic[pr] = 1
	while num != pr:
		num = num // pr
		pr = small[num]
		if pr in dic:
			dic[pr] += 1
		else:
			dic[pr] = 1
	for ii in dic:
		se.add(ii)
	if j == 0:
		dic1 = dic.copy()
	elif j == 1:
		dic2 = dic.copy()
for i in se:
	primear[i] = [dic1.get(i, 0)]
	primear[i].append(dic2.get(i, 0))
	primear[i].sort()
for j in range(2, nu):
	dic = {}
	num = ar[j]
	pr = small[num]
	if pr in dic:
		dic[pr] += 1
	else:
		dic[pr] = 1
	while num != pr:
		num = num // pr
		pr = small[num]
		if pr in dic:
			dic[pr] += 1
		else:
			dic[pr] = 1
	for i in primear:
		primear[i].append(dic.get(i, 0))
		primear[i].sort()
		del primear[i][-1]
ans = 1
for i in primear:
	ans *= i ** max(primear[i])
print(ans)


primes = []
lp = [0 for _ in range(200001)]
for i in range(2, 200001):
	if lp[i] == 0:
		lp[i] = i
		primes.append(i)
	j = 0
	while j < len(primes) and primes[j] <= lp[i] and (i * primes[j] <= 200000):
		lp[i * primes[j]] = primes[j]
		j += 1
n = int(input())
first = {r: 10000000 for r in primes}
second = {r: 10000000 for r in primes}
ct = {r: 0 for r in primes}
a = [int(x) for x in input().split()]
for x in a:
	y = x
	dctny = {}
	while y != 1:
		if lp[y] in dctny:
			dctny[lp[y]] += 1
		else:
			dctny[lp[y]] = 1
		y = y // lp[y]
	for (r, s) in dctny.items():
		ct[r] += 1
		if first[r] > s:
			second[r] = first[r]
			first[r] = s
		elif second[r] > s:
			second[r] = s
for (r, s) in ct.items():
	if s < n - 1:
		second[r] = 0
	elif s == n - 1:
		second[r] = first[r]
ans = 1
for (r, s) in second.items():
	ans *= r ** s
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
divs = {}
i = 0
for numb in a:
	for d in divs:
		foo = 0
		if divs[d][1] > 0:
			while numb % d == 0:
				numb //= d
				foo += 1
			if foo < divs[d][0]:
				divs[d][1] = divs[d][0]
				divs[d][0] = foo
			elif foo < divs[d][1]:
				divs[d][1] = foo
	if numb > 1 and i < 2:
		j = 2
		while numb > 1:
			if numb % j == 0:
				foo = 0
				while numb % j == 0:
					numb //= j
					foo += 1
				if i == 0:
					divs[j] = [foo, 1000]
				else:
					divs[j] = [0, foo]
			j += 1
	i += 1
sol = 1
for d in divs:
	sol *= d ** divs[d][1]
print(sol)


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

def lcm(a, b):
	return a * b / gcd(a, b)
n = int(input())
flag = 0
a = list(map(int, input().split()))
if n == 2:
	print(int(lcm(a[0], a[1])))
	flag = 1
if n == 3:
	ans = gcd(lcm(a[0], a[1]), lcm(a[0], a[2]))
	ans = gcd(ans, lcm(a[1], a[2]))
	print(int(ans))
	flag = 1
if flag == 0:
	gcds = [gcd(a[n - 1], a[n - 2])]
	for i in range(3, n):
		gcds.append(gcd(a[n - i], gcds[i - 3]))
	gcds = gcds[::-1]
	lcms = []
	for i in range(n - 2):
		lcms.append(lcm(gcds[i], a[i]))
	num1 = lcms[0]
	num2 = lcms[1]
	ans = gcd(num1, num2)
	for i in range(2, len(lcms)):
		ans = gcd(ans, lcms[i])
	print(int(ans))


import os
import sys
from io import BytesIO, IOBase
from math import log2, ceil, sqrt, gcd, log
from collections import *
from bisect import *
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
g = lambda : input().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(n,) = gil()
a = gil()
f = {}
v = a.pop()
while v & 1 == 0:
	f[2] = f.get(2, 0) + 1
	v //= 2
i = 3
while i * i <= v:
	while v % i == 0:
		f[i] = f.get(i, 0) + 1
		v //= i
	i += 2
if v > 1:
	f[v] = 1
v = a[-1]
ans = {}
p = {}
d = 0
while v & 1 == 0:
	v //= 2
	d += 1
if d:
	p[2] = d
i = 3
while i * i <= v:
	d = 0
	while v % i == 0:
		v //= i
		d += 1
	if d:
		p[i] = d
	i += 2
if v > 1:
	p[v] = 1
for fi in f:
	ans[fi] = p.get(fi, 0) + max(0, f[fi] - p.get(fi, 0))
for fi in p:
	ans[fi] = p[fi] + max(0, f.get(fi, 0) - p[fi])
while a:
	p = {}
	v = a.pop()
	for fi in ans:
		while v % fi == 0:
			p[fi] = p.get(fi, 0) + 1
			v //= fi
		ans[fi] = min(ans[fi], p.get(fi, 0) + max(0, f.get(fi, 0) - p.get(fi, 0)))
		f[fi] = min(f.get(fi, 0), p.get(fi, 0))
val = 1
for v in ans:
	val *= v ** ans[v]
print(val)


def gcd(a, b):
	m = min(a, b)
	if a % m == 0 and b % m == 0:
		return m
	m = m // 2
	while m >= 1:
		if a % m == 0 and b % m == 0:
			return m
		m -= 1

def gcdAndLCM(arr, n):
	ans = 0
	temp = arr[n - 1]
	lcms = []
	for i in range(n - 2, -1, -1):
		tmp = temp * arr[i]
		temp = gcd(temp, arr[i])
		lcms.append(tmp // temp)
	m = min(lcms)
	flag = 0
	for i in lcms:
		if i % m != 0:
			flag = 1
			break
	if flag == 0:
		print(m)
		return
	else:
		m = m // 2
		while m >= 1:
			flag = 0
			for i in lcms:
				if i % m != 0:
					flag = 1
					break
			if flag == 0:
				print(m)
				return
			m -= 1

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	gcdAndLCM(arr, n)
main()


def sieve(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
prime = [True for i in range(200000 + 1)]
sieve(200000)
pri = []
pp = [[20, 20] for i in range(200001)]
for i in range(2, 200001):
	if prime[i]:
		pri.append(i)
n = int(input())
lis = sorted(map(int, input().split()))
for i in range(len(pri)):
	aa = pri[i]
	for j in range(n):
		c = 0
		at = lis[j]
		while at % aa == 0:
			at = at // aa
			c += 1
		if c < pp[aa][0]:
			pp[aa][1] = pp[aa][0]
			pp[aa][0] = c
		elif c < pp[aa][1]:
			pp[aa][1] = c
		if pp[aa][1] == 0:
			break
ans = 1
for i in range(17984):
	ans *= pri[i] ** pp[pri[i]][1]
print(ans)


from math import gcd
n = int(input())
a = list(map(int, input().split()))

def lcm(x1, x2):
	d = gcd(x1, x2)
	return x1 * x2 // d
q = gcd(a[0], a[1])
f = lcm(a[0], a[1])
for i in a[2:]:
	f = gcd(f, lcm(q, i))
	q = gcd(q, i)
print(f)


from collections import defaultdict
import math

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans
n = int(input())
arr = list(map(int, input().split(' ')))
factors = defaultdict(list)
primes = SieveOfEratosthenes(450)
for num in arr:
	sqrt = int(math.sqrt(num))
	x = num
	lst = defaultdict(int)
	for i in primes:
		if x % i != 0:
			continue
		if i > x:
			break
		while x > 1 and x % i == 0:
			lst[i] += 1
			x /= i
			x = int(x)
	i = x
	while x > 1 and x % i == 0:
		lst[i] += 1
		x /= i
		x = int(x)
	for i in lst.keys():
		factors[i].append(lst[i])
ans = 1
for i in factors.keys():
	lst = factors[i]
	lst = sorted(lst)
	if len(lst) == n:
		ans *= i ** lst[1]
	if len(lst) == n - 1:
		ans *= i ** lst[0]
print(ans)


n = int(input())
arr = [int(x) for x in input().split()]
import math
if n == 2:
	arr.sort()
	if arr[1] % arr[0] != 0:
		x = arr[1] * arr[0] // math.gcd(arr[1], arr[0])
		print(x)
		exit()
gcc = []
gcc.append(arr[n - 1])
gcc.append(math.gcd(arr[n - 1], arr[n - 2]))
for i in range(n - 3, 0, -1):
	gcc.append(math.gcd(gcc[-1], arr[i]))
for i in range(len(gcc)):
	gcc[i] = gcc[i] * arr[n - i - 2] // math.gcd(gcc[i], arr[n - i - 2])
ans = math.gcd(gcc[0], gcc[1])
for i in range(2, len(gcc)):
	ans = math.gcd(ans, gcc[i])
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
ar = [int(x) for x in input().split()]
d = {}
count = {}

def power(x, p):
	res = 1
	while p:
		if p & 1:
			res = res * x
		x = x * x
		p >>= 1
	return res
for i in ar:
	ct = 0
	temp = i
	while i % 2 == 0:
		ct += 1
		i //= 2
	if ct > 0:
		if 2 not in count:
			count[2] = 1
		else:
			count[2] += 1
		if 2 not in d:
			d[2] = [ct]
		else:
			d[2].append(ct)
	for j in range(3, int(i ** 0.5) + 1, 2):
		ct = 0
		while i % j == 0:
			ct += 1
			i //= j
		if ct > 0:
			if j not in count:
				count[j] = 1
			else:
				count[j] += 1
			if j not in d:
				d[j] = [ct]
			else:
				d[j].append(ct)
	if i > 2:
		if i not in count:
			count[i] = 1
		else:
			count[i] += 1
		if i not in d:
			d[i] = [1]
		else:
			d[i].append(1)
ans = 1
for i in count.keys():
	if count[i] == n:
		d[i].sort()
		ans *= power(i, d[i][1])
	elif count[i] == n - 1:
		d[i].sort()
		ans *= power(i, d[i][0])
print(ans)


from math import gcd
n = int(input())
arr = list(map(int, input().split()))
g = gcd(arr[0], arr[1])
s = arr[0] * arr[1] // g
for i in arr[2:]:
	s = gcd(s, i * g // gcd(g, i))
	g = gcd(g, i)
print(s)


from sys import stdin
from collections import Counter, deque
from itertools import product
input = stdin.buffer.readline
n = int(input())
ls = list(map(int, input().split()))

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)
if n == 2:
	(a, b) = ls
	print(a * b // gcd(a, b))
	exit()
res = 1
(u, mx) = (2, max(ls))
while u * u <= mx:
	(mn1, mn2) = (n, n)
	for (i, v) in enumerate(ls):
		cc = 0
		while v % u == 0:
			v //= u
			cc += 1
		ls[i] = v
		if cc <= mn1:
			(mn1, mn2) = (cc, mn1)
		elif cc < mn2:
			mn2 = cc
	if mn2 > 0:
		res *= u ** mn2
	u += 1
ls.sort()
if ls[1] == ls[-1]:
	res *= ls[1]
print(res)


def divs(n):
	d = 2
	res = {}
	while d * d <= n:
		if n % d == 0:
			if d not in res:
				res[d] = 1
			else:
				res[d] += 1
			n //= d
		else:
			d += 1
	if n != 1:
		if n not in res:
			res[n] = 1
		else:
			res[n] += 1
	return res
n = int(input())
a = list(map(int, input().split()))
max_a = max(a)
d = 2
ans = 1
while d * d <= max_a:
	one_found = False
	failed = False
	for i in range(n):
		if a[i] % d != 0:
			if one_found:
				failed = True
			else:
				one_found = True
	if not failed:
		ans *= d
		a = [a[i] // d if a[i] % d == 0 else a[i] for i in range(n)]
	else:
		for i in range(n):
			while a[i] % d == 0:
				a[i] //= d
		d += 1
	max_a = max(a)
while max_a != 1:
	one_found = False
	failed = False
	for i in range(n):
		if a[i] % max_a != 0:
			if one_found:
				failed = True
			else:
				one_found = True
	if not failed:
		ans *= max_a
		a = [a[i] // max_a if a[i] % max_a == 0 else a[i] for i in range(n)]
		max_a = max(a)
	else:
		break
print(ans)


import math
n = int(input())
l = list(map(int, input().split()))
suffix = [0] * n
suffix[n - 1] = l[n - 1]
for i in range(n - 2, -1, -1):
	suffix[i] = math.gcd(l[i], suffix[i + 1])
res = [0] * n
for i in range(n - 1):
	res[i] = l[i] * suffix[i + 1] // math.gcd(l[i], suffix[i + 1])
ans = math.gcd(res[0], res[1])
for i in range(2, len(res)):
	ans = math.gcd(res[i], ans)
print(ans)


from functools import reduce
from math import gcd
import sys
input = sys.stdin.buffer.readline

def lcm(i, j):
	return i * j // gcd(i, j)
n = int(input())
arr = [int(c) for c in input().split()]
pregcd = [-1] * n
pregcd[-2] = arr[-1]
for i in range(n - 3, -1, -1):
	pregcd[i] = gcd(pregcd[i + 1], arr[i + 1])
for i in range(len(pregcd) - 1):
	pregcd[i] = lcm(pregcd[i], arr[i])
pregcd.pop()
print(reduce(gcd, pregcd))


import sys
import math
input = sys.stdin.readline

def pi():
	return int(input())

def ti():
	return list(map(int, input().split()))

def ts():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	n = pi()
	a = ti()
	hcf = [0] * n
	for i in reversed(range(n)):
		if i == n - 1:
			hcf[i] = a[i]
			continue
		hcf[i] = math.gcd(hcf[i + 1], a[i])
	res = []
	for i in range(1, n, 1):
		res.append(int(a[i - 1] * hcf[i] / math.gcd(a[i - 1], hcf[i])))
	ans = res[0]
	for num in res:
		ans = math.gcd(ans, num)
	print(ans)
main()


import math
n = int(input())
a = list(map(int, input().split()))
suffix = [0] * n
suffix[-1] = a[-1]
for i in range(n - 2, -1, -1):
	suffix[i] = math.gcd(a[i], suffix[i + 1])
gcd1 = a[0] * suffix[1] // suffix[0]
for i in range(1, n - 1):
	lcm = a[i] * suffix[i + 1] // suffix[i]
	gcd1 = math.gcd(lcm, gcd1)
print(gcd1)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())

def lcm(a, b):
	return a * b // mt.gcd(a, b)
n = I()
l = L()
x = []
x = defaultdict(list)
d = l[0]
for i in l:
	d = mt.gcd(d, i)
for i in range(len(l)):
	l[i] //= d
m = 0
for i in range(len(l)):
	f = defaultdict(int)
	k = 2
	while l[i] != 1 and k < int(mt.sqrt(l[i]) + 1):
		if l[i] % k == 0:
			l[i] //= k
			f[k] += 1
		else:
			k += 1
	if l[i] != 1:
		f[l[i]] += 1
	for c in f.keys():
		m = max(m, len(x[c]) + 1)
		x[c].append(f[c])
for i in x.keys():
	if len(x[i]) == len(l) - 1 and len(x[i]) > 0:
		d *= pow(i, min(x[i]))
print(d)


import io, os
import sys
import bisect

def isprime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	if n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i ** 2 <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i += 6
	return True

def c_primes(n):
	ans = []
	for i in range(2, n + 1):
		if isprime(i):
			ans.append(i)
	return ans

def answer(n, a):
	a.sort()

	def ptup(lst, num):
		if num < lst[0]:
			lst[1] = lst[0]
			lst[0] = num
			return lst
	primes = c_primes(a[-1])
	factors = [[100, 100] for _ in range(len(primes))]
	for i in range(len(primes)):
		for j in range(n):
			e = a[j]
			num_ps = 0
			while e % primes[i] == 0 and num_ps < factors[i][1]:
				num_ps += 1
				e = e // primes[i]
			indx = bisect.bisect_left(factors[i], num_ps)
			if indx < 2:
				factors[i].insert(indx, num_ps)
				factors[i].pop(2)
			if factors[i] == [0, 0]:
				break
	res = 1
	for i in range(len(factors)):
		num_f = factors[i][1]
		res = res * primes[i] ** num_f
	return res

def main():
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	print(answer(n, a))
	return
main()


from itertools import compress
from sys import stdin
IBUF = iter(stdin.readlines())
input = IBUF.__next__
n = int(input())
seq = list(map(int, input().split()))
amax = max(seq)
primes = [True] * (amax + 1)
p = 2
while p * p <= amax:
	if primes[p]:
		for i in range(p * p, amax + 1, p):
			primes[i] = False
	p += 1
ans = 1
for p in compress(range(2, amax + 1), primes[2:]):
	(lowest, second_lowest) = (999, 999)
	skipped = 0
	for (index, a) in enumerate(seq):
		power = 0
		while a % p == 0:
			power += 1
			a /= p
		seq[index] = a
		if power == 0:
			skipped += 1
		if skipped == 2:
			second_lowest = 0
			break
		if power <= lowest:
			second_lowest = lowest
			lowest = power
		elif power < second_lowest:
			second_lowest = power
	ans *= pow(p, second_lowest) if second_lowest != 999 else 1
print(ans)


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

def helper(x, d):
	upper = math.floor(math.sqrt(x))
	for i in range(2, upper + 1):
		if x % i == 0:
			d[i] = d.get(i, 0) + 1
			if i * i != x:
				d[x // i] = d.get(x // i, 0) + 1
	d[x] = d.get(x, 0) + 1
	return d

def lcm(a, b):
	upper = min(a, b)
	for i in range(upper, 0, -1):
		if a % i == 0 and b % i == 0:
			return a * b // i
d = {}
for item in a:
	d = helper(item, d)
ans = 1
for (k, v) in d.items():
	if v >= n - 1:
		ans = lcm(ans, k)
print(ans)


from math import gcd

def solve(n, a):
	prefix_gcd = [a[0]]
	for i in range(1, n):
		prefix_gcd.append(gcd(prefix_gcd[-1], a[i]))
	suffix_gcd = [a[-1]]
	for i in range(1, n):
		suffix_gcd.append(gcd(suffix_gcd[-1], a[~i]))
	suffix_gcd.reverse()
	result = suffix_gcd[1]
	for i in range(1, n - 1):
		curr = gcd(prefix_gcd[i - 1], suffix_gcd[i + 1])
		result = result * curr // gcd(result, curr)
	result = result * prefix_gcd[-2] // gcd(result, prefix_gcd[-2])
	return result
n = int(input())
a = [int(x) for x in input().split()]
print(solve(n, a))


def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x
from collections import defaultdict as d
n = int(input())
arr = [int(x) for x in input().split()]
factorCounts = d(lambda : 0)
for x in arr:
	for f in range(1, int(x ** 0.5) + 1):
		if x % f == 0:
			factorCounts[f] += 1
			if x // f != f:
				factorCounts[x // f] += 1
takenFactors = list()
for (factor, cnts) in factorCounts.items():
	if cnts >= n - 1:
		takenFactors.append(factor)
takenFactors = list(takenFactors)
ans = takenFactors[0]
for i in range(1, len(takenFactors)):
	gcd_ = gcd(ans, takenFactors[i])
	ans *= takenFactors[i]
	ans //= gcd_
print(ans)


from sys import stdin, stdout
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
dgnl = lambda x: sqrt(2 * x ** 2)
n = I()
a = L()
v = []
g = a[0]
for i in a[1:]:
	v += (lcm(g, i),)
	g = gcd(g, i)
for i in v[1:]:
	v[0] = gcd(v[0], i)
print(v[0])


import sys, math, cmath, time
start_time = time.time()
tt = 0

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	a = inlt()
	a.sort()
	q = [0] * 200004
	for i in range(len(a)):
		j = 2
		while j ** 2 < a[i]:
			if a[i] % j == 0:
				q[j] = q[j] + 1
				q[a[i] // j] = q[a[i] // j] + 1
			j = j + 1
		if j ** 2 == a[i]:
			q[j] = q[j] + 1
		q[a[i]] = q[a[i]] + 1
	w = 1
	qq = 1
	qw = 0
	for i in range(200000):
		if q[i] == n - 1:
			qq = qq * i // math.gcd(qq, i)
		elif q[i] == n:
			w = i
		qw = qq * w // math.gcd(qq, w)
	print(qw)

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))

def gcd(a, b):
	if b > a:
		(a, b) = (b, a)
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
g = A[0]
for a in A:
	g = gcd(g, a)
B = [a // g for a in A]
if N == 2:
	print(B[0] * B[1] * g)
	exit(0)

def fac(a):
	if a == 1:
		return {}
	ret = {}
	for i in range(2, a + 1):
		if i * i > a:
			break
		count = 0
		while a % i == 0:
			a = a // i
			count += 1
		if count > 0:
			ret[i] = count
	if a != 1:
		ret[a] = 1
	return ret
f0 = fac(B[0])
f1 = fac(B[1])
summary = {}
for (k, v) in f0.items():
	if k in f1:
		summary[k] = [min(f0[k], f1[k]), 0]
	else:
		summary[k] = [v, 1]
for (k, v) in f1.items():
	if not k in summary:
		summary[k] = [v, 1]
keys = summary.keys()
for i in range(2, len(B)):
	b = B[i]
	for k in keys:
		count = 0
		while b % k == 0:
			b = b // k
			count += 1
		if count == 0:
			summary[k][1] += 1
		else:
			summary[k][0] = min(summary[k][0], count)
ans = g
for k in keys:
	if summary[k][1] == 1:
		ans *= k ** summary[k][0]
print(ans)


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	tc = 0
	if tc:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	n = ii()
	a = li()
	f = [0] * n
	f[n - 1] = a[n - 1]
	for i in range(n - 2, -1, -1):
		f[i] = gcd(a[i], f[i + 1])
	x = []
	for i in range(n - 1):
		y = a[i] * f[i + 1] // gcd(a[i], f[i + 1])
		x.append(y)
	ans = x[0]
	for i in range(1, len(x)):
		ans = gcd(ans, x[i])
	print(ans)
solve()


from math import *
n = int(input())
a = list(map(int, input().split()))
k = []
lcm = [1 for i in range(n)]
lcm[-1] = a[-1]
for kk in range(len(a) - 2, -1, -1):
	lcm[kk] = gcd(lcm[kk + 1], a[kk])
ans = []
for i in range(n - 1):
	j = gcd(lcm[i + 1], a[i])
	ans.append(lcm[i + 1] * a[i] // j)
remo = ans[0]
for i in range(1, len(ans)):
	remo = gcd(remo, ans[i])
print(remo)


import math
from collections import defaultdict, Counter

def get_prime_factors(n):
	factors = []
	for i in range(2, int(math.sqrt(n)) + 3):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(list)
for i in range(n):
	counts = Counter(get_prime_factors(a[i]))
	for c in counts:
		d[c].append(counts[c])
ans = 1
for (key, value) in d.items():
	if len(value) <= n - 2:
		continue
	elif len(value) == n - 1:
		power = sorted(value)[0]
	else:
		power = sorted(value)[1]
	ans *= key ** power
print(ans)


from math import gcd
(n, d1, d2) = (int(input()), 0, 0)
for e in map(int, input().split()):
	(d2, d1) = (gcd(d2, d1 * e), gcd(d1, e))
print(d2 // d1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def bfs(g, st):
	visited = [-1] * len(g)
	visited[st] = 0
	queue = []
	queue.append(st)
	new = []
	while len(queue) != 0:
		s = queue.pop()
		new.append(s)
		for i in g[s]:
			if visited[i] == -1:
				visited[i] = visited[s] + 1
				queue.append(i)
	return visited

def dfsusingstack(v, st):
	d = deque([])
	visited = [0] * len(v)
	d.append(st)
	new = []
	visited[st] = 1
	while len(d) != 0:
		curr = d.pop()
		new.append(curr)
		for i in v[curr]:
			if visited[i] == 0:
				visited[i] = 1
				d.append(i)
	return new

def sieve(a, n):
	for i in range(3, n + 1, 2):
		a[i] = 1
	for i in range(3, n + 1, 2):
		for j in range(i * i, n + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def solve():
	n = int(inp())
	a = lis()
	g = []
	m = max(a)
	g = []
	for i in range(0, n):
		if i == 0:
			g.append(a[i])
		else:
			g.append(gcd(g[i - 1], a[i]))
	final = []
	for i in range(0, n):
		if i == 0:
			final.append(g[i])
		else:
			final.append(lcm(a[i], g[i - 1]))
	ans = final[1]
	for i in range(2, n):
		ans = gcd(ans, final[i])
	print(ans)
testcase(1)


import math as mt
from collections import Counter
MAXN = 200001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret
sieve()
n = int(input())
a = [int(o) for o in input().split()]
d = dict()
for i in a:
	dd = dict(Counter(getFactorization(i)))
	for j in dd:
		try:
			d[j].append(dd[j])
		except:
			d[j] = [dd[j]]
ans = 1
for i in d:
	d[i] = sorted(d[i])
	if len(d[i]) == n - 1:
		ans *= pow(i, d[i][0])
	elif len(d[i]) == n:
		ans *= pow(i, d[i][1])
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
result = [0] * n
result[-1] = a[-1]
for i in range(n - 2, -1, -1):
	result[i] = math.gcd(a[i], result[i + 1])
for i in range(n - 1):
	result[i] = a[i] * result[i + 1] // math.gcd(a[i], result[i + 1])
result.pop()
ans = result[0]
for i in result:
	ans = math.gcd(ans, i)
print(ans)


import math
N = int(input())
aa = list(map(int, input().split()))

def hurui(N):
	koho = list(range(2, N))
	prime = []
	limit = math.sqrt(koho[-1])
	while True:
		p = koho[0]
		if limit <= p:
			prime = prime + koho
			break
		else:
			prime.append(p)
			koho = [e for e in koho if e % p != 0]
	return prime
primes = hurui(max(aa) + 3)

def min2(ar):
	min_ = min(ar)
	ar.remove(min_)
	return min(ar)
ans = 1
for (pi, p) in enumerate(primes):
	cnts = []
	cnt0 = 0
	for (ai, a) in enumerate(aa):
		cnt = 0
		while a % p == 0:
			a //= p
			cnt += 1
		cnts.append(cnt)
		if cnt == 0:
			if cnt0 == 0:
				cnt0 += 1
			else:
				break
	ans *= pow(p, min2(cnts))
print(ans)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
inf = float('inf')
from collections import defaultdict as dd
from collections import Counter, deque
from heapq import *
import math
from math import floor, ceil, sqrt

def geti():
	return map(int, input().strip().split())

def getl():
	return list(map(int, input().strip().split()))

def getis():
	return map(str, input().strip().split())

def getls():
	return list(map(str, input().strip().split()))

def gets():
	return input().strip()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')
maxn = int(200000.0 + 5)
p = list(range(maxn))
primes = []
for i in range(2, maxn):
	if p[i] == i:
		for j in range(i * i, maxn, i):
			p[j] = i

def solve():
	n = geta()
	a = getl()
	factors = dd(list)
	for i in a:
		while i != 1:
			count = 0
			now = p[i]
			while i % now == 0:
				i //= now
				count += 1
			factors[now].append(count)
	ans = 1
	for i in factors:
		if len(factors[i]) > n - 1:
			ans *= i ** sorted(factors[i])[1]
		elif len(factors[i]) == n - 1:
			ans *= i ** sorted(factors[i])[0]
	print(ans)
solve()


from sys import stdin
import math
a = int(stdin.readline())
b = stdin.readline().split()
gcd = int(b[0])
if a == 1:
	print(1)
else:
	for c in range(0, a - 1):
		gcd = math.gcd(gcd, int(b[c + 1]))
	d = list()
	for k in range(0, a):
		d.append(int(int(b[k]) / gcd))
	GCD = gcd
	for j in range(2, max(d) + 1):
		count = 0
		k = 0
		p = 1
		W = 0
		for u in range(2, int(math.floor(math.sqrt(j))) + 1):
			if j % u == 0:
				W = 1
				break
		while count < 2 and (k < a and W == 0):
			if d[k] % j ** p != 0:
				count += 1
			k += 1
			if k == a and count < 2:
				GCD = GCD * j
				count = 0
				k = 0
				p += 1
	print(GCD)


import math

def prime_factorization(x):
	result = []
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			count = 0
			while x % i == 0:
				count += 1
				x //= i
			result.append((i, count))
	if x > 1:
		result.append((x, 1))
	return result
n = int(input())
data = list(map(int, input().split()))
process = {}
for i in data:
	prime_factors = prime_factorization(i)
	for (prime_factor, count) in prime_factors:
		if prime_factor not in process:
			process[prime_factor] = [count]
		else:
			process[prime_factor].append(count)
result = 1
for (prime_factor, count_list) in process.items():
	count_list.sort()
	if len(count_list) == n - 1:
		result *= prime_factor ** count_list[0]
	elif len(count_list) == n:
		result *= prime_factor ** count_list[1]
print(result)


import math
a = int(input())
z = list(map(int, input().split()))
from collections import defaultdict
al = defaultdict(list)

def prime(n):
	count = 0
	while n % 2 == 0:
		count += 1
		n = n // 2
	al[2].append(count)
	for i in range(3, int(math.sqrt(n) + 1), 2):
		c1 = 0
		while n % i == 0:
			c1 += 1
			n = n // i
		al[i].append(c1)
	if n > 2:
		al[n].append(1)
count = 1
t = 1
if len(z) == 2:
	print(z[0] * z[1] // math.gcd(z[0], z[1]))
	exit()
for i in range(len(z)):
	prime(z[i])
for i in al.keys():
	al[i].sort()
	if len(al[i]) >= len(z) - 1 and len(al[i]) >= 2:
		count = count * pow(i, al[i][1])
print(count)


import math

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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
s = []
h = 0
for i in a:
	s.append(lcm(i, h))
	h = gcd(h, i)
flag = 0
for i in s:
	flag = gcd(flag, i)
print(flag)


import math

def pf(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n // i
	if n > 2:
		l.append(n)
	return l
n = int(input())
p = [[] for i in range(200005)]
a = list(map(int, input().split()))
ans = 1
for i in range(n):
	l = pf(a[i])
	for j in range(len(l)):
		if j == 0:
			p[l[j]].append(1)
		elif l[j] == l[j - 1]:
			p[l[j]][-1] += 1
			continue
		else:
			p[l[j]].append(1)
for i in range(len(p)):
	if len(p[i]) == n - 1:
		for j in range(min(p[i])):
			ans *= i
	if len(p[i]) == n:
		p[i].sort()
		for j in range(p[i][1]):
			ans *= i
print(ans)


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

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
a = list(map(int, input().split()))
gcda = [a[-1]]
m = a[::-1]
for i in range(1, n):
	gcda.append(gcd(gcda[-1], m[i]))
gcda = gcda[::-1]
answer = lcm(a[0], gcda[1])
for i in range(1, len(a)):
	if i == len(a) - 1:
		continue
	else:
		answer = gcd(answer, lcm(a[i], gcda[i + 1]))
	if answer == 1:
		break
print(answer)


def sieve(x):
	is_prime = [True] * (x + 1)
	is_prime[0] = is_prime[1] = False
	ret = []
	for i in range(2, x + 1):
		if is_prime[i]:
			ret.append(i)
			for j in range(i * 2, x + 1, i):
				is_prime[j] = False
	return ret

def main():
	n = int(input())
	a = list(map(int, input().split()))
	INF = 10 ** 9
	MAX = max(a)
	primes = sieve(MAX)
	mn1 = [INF] * (MAX + 1)
	mn2 = [INF] * (MAX + 1)
	for p in primes:
		for i in range(n):
			cnt = 0
			while a[i] % p == 0:
				a[i] //= p
				cnt += 1
			if cnt <= mn1[p]:
				(mn1[p], mn2[p]) = (cnt, mn1[p])
			elif cnt < mn2[p]:
				mn2[p] = cnt
			if mn2[p] == 0:
				break
	ans = 1
	for (i, e) in enumerate(mn2[2:], 2):
		if e == INF:
			continue
		ans *= pow(i, e)
	print(ans)
main()


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
spf = [0] * 200005

def sieve():
	spf[1] = 1
	for i in range(2, 200005):
		spf[i] = i
	for i in range(4, 200005, 2):
		spf[i] = 2
	for i in range(3, int(200005 ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, 200005, i):
				if spf[j] == j:
					spf[j] = i

def pFactor(x):
	ret = Counter()
	while x > 1:
		(tmp, cnt) = (spf[x], 1)
		x //= tmp
		while x % tmp == 0:
			(x, cnt) = (x // tmp, cnt + 1)
		ret[tmp] = cnt
	return ret
sieve()
n = int(input())
a = list(mapi())
b = [pFactor(i) for i in a]
freq = defaultdict(list)
for i in b:
	for (j, v) in i.items():
		freq[j].append(v)
ans = 1
for (i, v) in freq.items():
	v.sort()
	if len(v) == n:
		ans *= i ** v[1]
	elif len(v) == n - 1:
		ans *= i ** v[0]
print(ans)


import sys
from array import array
from typing import List, Tuple, TypeVar, Generic, Sequence, Union

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def get_primes(n: int):
	from itertools import chain
	from array import array
	primes = [2, 3]
	is_prime = array('b', (0, 0, 1, 1, 0, 1, 0)) + array('b', (1, 0, 0, 0, 1, 0)) * ((n - 1) // 6)
	for i in chain.from_iterable((range(5, n + 1, 6), range(7, n + 1, 6))):
		if is_prime[i]:
			primes.append(i)
			for j in range(i * 3, n + 1, i * 2):
				is_prime[j] = 0
	return (is_prime, primes)

def main():
	from collections import Counter
	(_, primes) = get_primes(447)
	(cnt1, cnt2) = ([10 ** 9] * len(primes), [10 ** 9] * len(primes))
	big = Counter()
	n = int(input())
	a = list(map(int, input().split()))
	for x in a:
		for (i, p) in enumerate(primes):
			e = 0
			while x % p == 0:
				x //= p
				e += 1
			if cnt1[i] > e:
				(cnt1[i], cnt2[i]) = (e, cnt1[i])
			elif cnt2[i] > e:
				cnt2[i] = e
		if x > 1:
			big[x] += 1
	ans = 1
	for (i, p) in enumerate(primes):
		ans *= p ** cnt2[i]
	for (key, val) in big.items():
		if val >= n - 1:
			ans *= key
	print(ans)
main()


from math import *
from bisect import *
from collections import Counter, defaultdict, deque
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
n = I()
a = LI()
b = [0] * n
b[n - 1] = a[-1]
for i in range(n - 2, -1, -1):
	b[i] = gcd(a[i], b[i + 1])
c = [0] * n
for i in range(n - 1):
	c[i] = a[i] * b[i + 1] // b[i]
ans = 0
for i in range(n):
	ans = gcd(ans, c[i])
print(ans)


from math import gcd
n = int(input())
l = [int(j) for j in input().split()]
gc = [0 for i in range(n)]
gc[-1] = l[-1]
for i in range(n - 2, -1, -1):
	gc[i] = gcd(gc[i + 1], l[i])
ans = []
for i in range(n - 1):
	ans.append(l[i] * gc[i + 1] // gcd(l[i], gc[i + 1]))
ans1 = ans[0]
for i in range(1, n - 1):
	ans1 = gcd(ans1, ans[i])
print(ans1)


from math import gcd
import sys
n = int(input())
a = [int(x) for x in input().split()]
if n == 2:
	print(a[0] * a[1] // gcd(a[0], a[1]))
	sys.exit()
primes = [2]
for i in range(3, 1000, 2):
	for p in primes:
		if i % p == 0:
			break
		if p * p > i:
			primes.append(i)
			break
poss_primes = set()
for i in range(3):
	ai = a[i]
	for p in primes:
		if ai % p == 0:
			poss_primes.add(p)
			while ai % p == 0:
				ai //= p
	if ai != 1:
		poss_primes.add(ai)
locc = {p: 999 for p in poss_primes}
slocc = {p: 1000 for p in poss_primes}
for p in poss_primes:
	for i in range(n):
		ai = a[i]
		ct = 0
		while ai % p == 0:
			ai //= p
			ct += 1
		if ct <= locc[p]:
			(locc[p], slocc[p]) = (ct, locc[p])
		elif ct < slocc[p]:
			slocc[p] = ct
			if ct == 0:
				break
acc = 1
for p in poss_primes:
	acc *= p ** slocc[p]
print(acc)


from sys import stdin, stdout
from collections import deque
input = stdin.readline
from math import gcd

def main():
	n = int(input())
	ai = list(map(int, input().split()))
	if n == 2:
		print(ai[0] * ai[1] // gcd(ai[0], ai[1]))
		return

	def create(ai):
		tr = [[[ai[i], i, i] for i in range(n)]]
		n2 = n
		while n2 > 1:
			n3 = n2 // 2 + n2 % 2
			tr += [[[0, n, 0] for j in range(n3)]]
			for i in range(n2):
				if i + 1 - i % 2 * 2 < n2:
					tr[-1][i // 2][0] = gcd(tr[-2][i][0], tr[-2][i + 1 - i % 2 * 2][0])
				else:
					tr[-1][i // 2][0] = tr[-2][i][0]
				tr[-1][i // 2][1] = min(tr[-1][i // 2][1], tr[-2][i][1])
				tr[-1][i // 2][2] = max(tr[-1][i // 2][2], tr[-2][i][2])
			n2 = n3
		return tr

	def change(ind, val):
		n2 = len(tr)
		change = val - tr[0][ind][0]
		for i in range(n2):
			tr[i][ind][0] += change
			ind //= 2
		return 0

	def count(l, r):
		d = deque()
		d.append([-1, 0])
		ans = 0
		while len(d) > 0:
			(i, j) = d.pop()
			if tr[i][j][1] >= l and tr[i][j][2] <= r:
				if ans == 0:
					ans = tr[i][j][0]
				else:
					ans = gcd(ans, tr[i][j][0])
			elif min(tr[i][j][2], r) >= max(tr[i][j][1], l):
				d.append([i - 1, j * 2])
				if j * 2 + 1 < len(tr[i - 1]):
					d.append([i - 1, j * 2 + 1])
		return ans
	tr = create(ai)
	ans = count(0, n - 2)
	temp = count(1, n - 1)
	ans = ans * temp // gcd(temp, ans)
	for i in range(1, n - 1):
		temp = count(0, i - 1)
		temp2 = count(i + 1, n - 1)
		temp = gcd(temp, temp2)
		ans = ans * temp // gcd(temp, ans)
	print(ans)
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
from collections import defaultdict

def factorize(n):
	i = 2
	result = defaultdict(int)
	while True:
		if i ** 2 > n:
			break
		count = 0
		while n % i == 0:
			n //= i
			count += 1
		if count != 0:
			result[i] = count
		i += 1
	if n > 1:
		result[n] = 1
	return result

def main():
	n = int(input())
	A = tuple(map(int, input().split()))
	p_set = set()
	p_min = defaultdict(int)
	p_sec = defaultdict(int)
	p_cnt = defaultdict(int)
	for a in A:
		F = factorize(a)
		for (p, num) in F.items():
			p_set.add(p)
			p_cnt[p] += 1
			if p_min[p] == 0 or num <= p_min[p]:
				tmp = p_min[p]
				p_min[p] = num
				p_sec[p] = tmp
			elif p_sec[p] == 0 or num < p_sec[p]:
				p_sec[p] = num
	ans = 1
	for p in p_set:
		if p_cnt[p] == n:
			ans *= pow(p, p_sec[p])
		elif p_cnt[p] == n - 1:
			ans *= pow(p, p_min[p])
	sys.stdout.write(str(ans) + '\n')
main()


import sys
input = sys.stdin.readline

def mult_input():
	return map(int, input().split())

def list_input():
	return list(map(int, input().split()))
prime = [[] for i in range(200001)]
for i in range(2, 200001):
	if len(prime[i]) == 0:
		for j in range(i, 200001, i):
			prime[j].append(i)
n = int(input())
l = list_input()
s = []
location = {}
for i in range(n):
	for j in prime[l[i]]:
		if j not in location:
			location[j] = {i: 0}
		if True:
			m = l[i]
			while m % j == 0:
				if i not in location[j]:
					location[j][i] = 1
				else:
					location[j][i] += 1
				m = m // j
		s.append(j)
s = set(s)
ans = 1
for i in s:
	if len(location[i]) < n - 1:
		continue
	else:
		m = 10 ** 9
		for j in location[i]:
			m = min(location[i][j], m)
	if len(location[i]) == n - 1:
		ans = ans * i ** m
		continue
	count = 0
	for j in location[i]:
		if location[i][j] == m:
			count += 1
	if count >= 2:
		ans = ans * i ** m
		continue
	minn = 10 ** 9
	for j in location[i]:
		if location[i][j] > m:
			minn = min(minn, location[i][j])
	ans = ans * i ** minn
print(ans)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
ans = 0
for i in range(len(a) - 1, -1, -1):
	b[i] = gcd(a[i], ans)
	ans = b[i]
c = [a[i] * (b[i + 1] // b[i]) for i in range(n - 1)]
fin = 0
for i in c:
	fin = gcd(fin, i)
print(fin)


import collections as cc, math as mt
import sys
I = lambda : list(map(int, input().split()))
(n,) = I()
l = [0] + I()
suf = [0] * (n + 1)
suf[-1] = l[-1]
for i in range(n - 1, 0, -1):
	suf[i] = mt.gcd(l[i], suf[i + 1])
b = [0] * (n + 1)
for i in range(1, n):
	b[i] = int(l[i] * suf[i + 1] / mt.gcd(l[i], suf[i + 1]))
tot = b[1]
for i in range(2, n):
	tot = mt.gcd(tot, b[i])
print(tot)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
maxn = 500
prime = []
k = [0] * maxn
for i in range(2, maxn):
	if k[i] == 0:
		prime.append(i)
		for j in range(i * i, maxn, i):
			k[j] = 1
(n,) = map(int, input().split())
arr = list(map(int, input().split()))
mp = collections.defaultdict(list)
for ac in arr:
	j = 0
	while j < len(prime) and ac >= prime[j]:
		p = prime[j]
		cnt = 0
		while ac % p == 0:
			cnt += 1
			ac //= p
		mp[p].append(cnt)
		j += 1
	if ac > 1:
		mp[ac].append(1)
ans = 1
for (k, v) in mp.items():
	if len(v) >= n - 1:
		ans *= pow(k, sorted(v)[1 - n])
print(ans)


import sys
input = sys.stdin.readline
import math
from collections import Counter

def prime_factorize(n, unique=False):
	b = 2
	fct = []
	while b * b <= n:
		while n % b == 0:
			n //= b
			fct.append(b)
		b = b + 1
	if n > 1:
		fct.append(n)
	if unique:
		return set(fct)
	else:
		return fct
n = int(input())
a = [int(item) for item in input().split()]
primes = [[] for _ in range(200000 + 10)]
for item in a:
	fct = prime_factorize(item)
	cnt = Counter(fct)
	for (key, val) in cnt.items():
		primes[key].append(val)
ans = 1
for (i, line) in enumerate(primes):
	if len(line) < n - 1:
		continue
	line.sort()
	if len(line) == n - 1:
		ans *= i ** line[0]
		continue
	ans *= i ** max(line[0], line[1])
print(ans)


import sys
I = sys.stdin.readline
n = int(I())
a = list(map(int, I().split()))

def gcd(a, b):
	while b != 0:
		temp = b
		b = a % b
		a = temp
	return a
suff_gcd = [0] * n
suff_gcd[-1] = a[-1]
gcd_list = []
for i in range(n - 2, -1, -1):
	suff_gcd[i] = gcd(a[i], suff_gcd[i + 1])
for i in range(n - 1):
	gcd_list.append(a[i] * suff_gcd[i + 1] // gcd(a[i], suff_gcd[i + 1]))
ans = gcd_list[0]
for i in gcd_list[1:]:
	ans = gcd(ans, i)
print(ans)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
lt = [int(x) for x in input().split()]
(pref, suf) = ([0] * n, [0] * n)
(pref[0], suf[n - 1]) = (lt[0], lt[n - 1])
for i in range(1, n):
	pref[i] = gcd(pref[i - 1], lt[i])
for i in range(n - 2, -1, -1):
	suf[i] = gcd(suf[i + 1], lt[i])
g = [0] * n
g[0] = suf[1]
g[n - 1] = pref[n - 2]
for i in range(1, n - 1):
	g[i] = gcd(pref[i - 1], suf[i + 1])
l = g[0]
for i in range(1, n):
	l = lcm(l, g[i])
print(l)


import math
n = int(input())
a = list(map(int, input().split()))
gcd = [a[0]]
for i in range(1, n):
	gcd.append(math.gcd(gcd[-1], a[i]))
x = []
for i in range(n - 1, 0, -1):
	x.append(a[i] * gcd[i - 1] // math.gcd(a[i], gcd[i - 1]))
res = x[0]
for i in range(len(x)):
	res = math.gcd(res, x[i])
print(res)


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
import math

def divisors(n):
	ans = []
	i = 2
	s = int(math.sqrt(n))
	while n != 1:
		if not n % i:
			ans.append(i)
			n //= i
			s = int(math.sqrt(n))
		else:
			if i > s:
				ans.append(n)
				break
			i += 1
	return ans
n = ri()
a = r()
f = [[0] * 19 for i in range(200003)]
for ai in a:
	for (di, dv) in cd(divisors(ai)).items():
		f[di][dv] += 1
ans = 1
for (fi, fv) in enumerate(f):
	d = n - sum(fv)
	if d > 1:
		continue
	s = 0
	for (vi, vv) in enumerate(fv):
		s += vv
		if s > 1 - d:
			ans *= fi ** vi
			break
print(ans)


import math

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
N = int(input())
L1 = list(map(int, input().split()))
suffix_gcd = [L1[-1]]
for i in range(N - 2, -1, -1):
	suffix_gcd.append(math.gcd(L1[i], suffix_gcd[-1]))
suffix_gcd.reverse()
array = []
for i in range(N - 1):
	array.append(L1[i] * suffix_gcd[i + 1] // math.gcd(L1[i], suffix_gcd[i + 1]))
final = array[0]
for i in range(len(array)):
	final = math.gcd(final, array[i])
print(final)


import math
n = int(input())
arr = [int(s) for s in input().split()]
suff = [0] * n
suff[n - 1] = arr[n - 1]
for i in range(len(arr) - 2, -1, -1):
	suff[i] = math.gcd(suff[i + 1], arr[i])
ans = arr[0] * suff[1] // suff[0]
for i in range(1, len(arr) - 1):
	ans = math.gcd(ans, arr[i] * suff[i + 1] // suff[i])
print(ans)


from math import gcd
t = int(input())
nums = [int(x) for x in input().split()]
(l, g) = (nums[0] * nums[1] // gcd(nums[0], nums[1]), gcd(nums[0], nums[1]))
gcds = []
for i in nums[2:]:
	(l, g) = (gcd(g * i // gcd(i, g), l), gcd(i, g))
print(l)


import collections

def prime_count(n):
	ret = collections.defaultdict(int)
	for i in range(2, int(n ** 0.5) + 1):
		while n % i == 0:
			ret[i] += 1
			n //= i
	if n != 1:
		ret[n] += 1
	return ret
n = int(input())
arr = list(map(int, input().split()))
primes = [[] for _ in range(200001)]
for i in range(n):
	dic = prime_count(arr[i])
	for key in dic.keys():
		primes[key].append(dic[key])
ans = 1
for i in range(200001):
	l = len(primes[i])
	if l <= n - 2:
		continue
	primes[i] = sorted(primes[i])
	if l == n - 1:
		ans *= pow(i, primes[i][0])
	elif l == n:
		ans *= pow(i, primes[i][1])
print(ans)


from math import sqrt
n = int(int(input()))
arr = list(map(int, input().split()))
d = {}
for i in range(n):
	if arr[i] % 2 == 0:
		if 2 in d:
			d[2][0] += 1
		else:
			d[2] = []
			d[2].append(1)
			d[2].append(float('inf'))
			d[2].append(float('inf'))
		count = 0
		while arr[i] % 2 == 0:
			count += 1
			arr[i] = arr[i] // 2
		if count <= d[2][1]:
			d[2][2] = d[2][1]
			d[2][1] = count
		elif count <= d[2][2]:
			d[2][2] = count
	for k in range(3, int(sqrt(arr[i])) + 1, 2):
		if arr[i] % k == 0:
			if k in d:
				d[k][0] += 1
			else:
				d[k] = []
				d[k].append(1)
				d[k].append(float('inf'))
				d[k].append(float('inf'))
			count = 0
			while arr[i] % k == 0:
				count += 1
				arr[i] = arr[i] // k
			if count <= d[k][1]:
				d[k][2] = d[k][1]
				d[k][1] = count
			elif count <= d[k][2]:
				d[k][2] = count
	if arr[i] > 2:
		if arr[i] in d:
			d[arr[i]][0] += 1
			if 1 <= d[arr[i]][1]:
				d[arr[i]][2] = d[arr[i]][1]
				d[arr[i]][1] = 1
			elif 1 <= d[arr[i][2]]:
				d[arr[i]][2] = 1
		else:
			d[arr[i]] = []
			d[arr[i]].append(1)
			d[arr[i]].append(1)
			d[arr[i]].append(float('inf'))
res = 1
for j in d:
	if d[j][0] == n - 1:
		res *= j ** d[j][1]
	elif d[j][0] == n:
		res *= j ** d[j][2]
print(res)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
L = list(map(int, input().split()))
g = gcd(L[-2], L[-1])
r = lcm(L[-2], L[-1])
for i in range(n - 3, -1, -1):
	r = gcd(lcm(L[i], g), r)
	g = gcd(g, L[i])
print(r)


n = int(input())
a = list(map(int, input().split()))
re = [True] * 200013
div = dict()
for i in range(2, 200013):
	if re[i]:
		div[i] = [10000000000, 100000000000]
		for j in range(i * i, 200013, i):
			re[j] = False
ntd = []
for i in a:
	n = i
	for j in div:
		c = 0
		while n % j == 0:
			n //= j
			c += 1
		if div[j][0] >= c:
			div[j][1] = div[j][0]
			div[j][0] = c
		elif div[j][1] > c:
			div[j][1] = c
		if div[j][1] == 0:
			ntd.append(j)
	for j in ntd:
		div.pop(j)
	ntd = []
ans = 1
for i in div:
	ans *= i ** div[i][1]
print(ans)


def gcd(a, b):
	(a, b) = (min(a, b), max(a, b))
	if a == 0:
		return b
	else:
		return gcd(b % a, a)
n = int(input())
arr = [int(i) for i in input().split()]
gcd_arr1 = [None for i in range(n)]
gcd_arr1[-1] = arr[-1]
for i in range(n - 1):
	index = n - 2 - i
	gcd_arr1[index] = gcd(gcd_arr1[index + 1], arr[index])
new_arr = [None for i in range(n - 1)]
for i in range(n - 1):
	new_arr[i] = int(arr[i] * gcd_arr1[i + 1] / gcd_arr1[i])
ans = new_arr[0]
for i in range(n - 1):
	ans = gcd(ans, new_arr[i])
print(ans)


def gcd(num1, num2):
	while num1:
		(num2, num1) = (num1, num2 % num1)
	return num2
n = int(input())
arr = list(map(int, input().rstrip().split()))
gcdPreComp = [0] * (n - 1) + [arr[-1]]
for pos in range(len(arr) - 2, -1, -1):
	gcdPreComp[pos] = gcd(arr[pos], gcdPreComp[pos + 1])
res = 0
for pos in range(n - 1):
	temp = arr[pos] * gcdPreComp[pos + 1] // gcdPreComp[pos]
	res = gcd(res, temp)
print(res)


from math import gcd
n = int(input())
hcf = [0] * n
lis = list(map(int, input().split()))
hcf[n - 1] = lis[n - 1]
for i in range(n - 2, -1, -1):
	hcf[i] = gcd(lis[i], hcf[i + 1])
a = []
for i in range(n - 1):
	x = gcd(lis[i], hcf[i + 1])
	a.append(lis[i] * hcf[i + 1] // x)
length = len(a)
for i in range(length - 2, -1, -1):
	a[i] = gcd(a[i], a[i + 1])
print(a[0])


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

def factorization(n):
	ret = dict()
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			ret[i] = cnt
	if temp != 1:
		ret[temp] = 1
	if len(ret) == 0:
		ret[n] = 1
	return ret
import math
L = [0] * n
R = [0] * n
L[0] = a[0]
R[-1] = a[-1]
for i in range(1, n):
	L[i] = math.gcd(L[i - 1], a[i])
for i in range(n - 2, -1, -1):
	R[i] = math.gcd(R[i + 1], a[i])
d = dict()
for i in range(n):
	k = 1
	if i == 0:
		k = R[i + 1]
	elif i == n - 1:
		k = L[i - 1]
	else:
		k = math.gcd(L[i - 1], R[i + 1])
	primes = factorization(k)
	for x in primes:
		if x not in d:
			d[x] = 0
		d[x] = max(d[x], primes[x])
ans = 1
for x in d:
	ans *= x ** d[x]
print(ans)


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

def l(a, b):
	return a * (b // g(a, b))
n = int(input())
a = [0] + list(map(int, input().split()))
p = a[1]
for i in range(2, n + 1):
	p = g(p, a[i])
b = []
for j in a:
	b.append(j // p)
s = [0, b[1]]
for i in range(2, n + 1):
	s.append(g(s[-1], b[i]))
ans = l(b[1], b[2])
for i in range(3, n + 1):
	ans = g(ans, b[i] * s[i - 1])
print(ans * p)


import math
n = int(input())
a = list(map(int, input().split()))
post = [0] * n
post[-1] = a[-1]
for i in range(n - 2, 0, -1):
	post[i] = math.gcd(post[i + 1], a[i])
ans = [0] * n
for i in range(n - 1):
	ans[i] = a[i] * post[i + 1] // math.gcd(a[i], post[i + 1])
out = 0
for i in range(n):
	out = math.gcd(out, ans[i])
print(out)


import math
import sys
input = sys.stdin.readline
t = 1
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	gc = [0, arr[0]]
	for i in range(1, n):
		gc += [math.gcd(gc[-1], arr[i])]
	for i in range(n - 1, 0, -1):
		y = gc[i]
		ans += [arr[i] * (y // math.gcd(y, arr[i]))]
	ans.reverse()
	x = 0
	for i in ans:
		x = math.gcd(x, i)
	print(x)


def prime_factors(x):
	ans = set()
	i = 2
	while i * i <= x:
		while x % i == 0:
			ans.add(i)
			x //= i
		i += 1
	if x > 1:
		ans.add(x)
	return ans
n = int(input())
a = list(map(int, input().split()))
factors = prime_factors(a[0]) | prime_factors(a[1])
res = 1
for p in factors:
	counts = []
	for x in a:
		count = 0
		while x % p == 0:
			x //= p
			count += 1
		counts.append(count)
	m = sorted(counts)[1]
	res *= p ** m
print(res)


from sys import stdin, stdout
from collections import Counter
Pr = []
Cm = set()
for i in range(2, 450):
	if i in Cm:
		continue
	Pr.append(i)
	for j in range(i, 450, i):
		Cm.add(j)
n = int(stdin.readline().strip())
alist = list(map(int, stdin.readline().split()))
D = {}
for a in alist:
	for p in Pr:
		if a == 1 or a % p:
			continue
		if p not in D:
			D[p] = Counter()
		i = 1
		while a % p == 0:
			D[p][i] += 1
			a //= p
			i += 1
	if a > 1:
		if a not in D:
			D[a] = Counter()
		D[a][1] += 1
ans = 1
for (p, c) in D.items():
	x = 0
	for (i, v) in c.items():
		if v == n or v == n - 1:
			x = max(x, i)
	ans *= p ** x
print(ans)


import heapq
import math as mt
MAXN = 200001
spf = [0 for i in range(MAXN)]

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def gF(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret
sieve()
dp = []
for j in range(2 * 10 ** 5 + 1):
	dp.append([])
n = int(input())
b = list(map(int, input().split()))
for j in range(n):
	p = gF(b[j])
	k = dict()
	for i in range(len(p)):
		if p[i] in k.keys():
			k[p[i]] += 1
		else:
			k[p[i]] = 1
	c = sorted(list(set(p)))
	for i in range(len(c)):
		dp[c[i]].append(k[c[i]])
x = 1
for j in range(2 * 10 ** 5 + 1):
	if len(dp[j]) >= n - 1:
		if len(dp[j]) == n - 1:
			heapq.heapify(dp[j])
			x *= j ** heapq.heappop(dp[j])
		else:
			heapq.heapify(dp[j])
			heapq.heappop(dp[j])
			x *= j ** heapq.heappop(dp[j])
	else:
		pass
print(x)


import math
import copy
n = int(input())
als = list(map(int, input().split()))
als.sort()
ans0 = 1
alscp0 = copy.deepcopy(als)
tmp = als[0]
for i in range(2, tmp + 1):
	while alscp0[0] % i == 0 and alscp0[0] / i > 0:
		fc = 0
		for j in range(n):
			if alscp0[j] % i != 0 or alscp0[j] / i == 0:
				if fc == 0:
					fc += 1
				else:
					fc += 1
			else:
				alscp0[j] = alscp0[j] / i
		if fc <= 1:
			ans0 = ans0 * i
ans1 = 1
alscp1 = copy.deepcopy(als)
tmp = als[1]
for i in range(2, tmp + 1):
	while alscp1[1] % i == 0 and alscp1[1] / i > 0:
		fc = 0
		for j in range(n):
			if alscp1[j] % i != 0 or alscp1[j] / i == 0:
				if fc == 0:
					fc += 1
				else:
					fc += 1
			else:
				alscp1[j] = alscp1[j] / i
		if fc <= 1:
			ans1 = ans1 * i
ans = ans0 * ans1 / math.gcd(ans0, ans1)
print(int(ans))


seive = [1 for i in range(2 * 10 ** 5 + 3)]
po = 2 * 10 ** 5 + 3
seive[0] = 0
seive[1] = 0
for i in range(po):
	if seive[i] == 1:
		j = i * i
		while j < po:
			seive[j] = 0
			j += i
arr = [[] for i in range(2 * 10 ** 5 + 3)]
n = int(input())
l = input().split()
li = [int(i) for i in l]
for i in li:
	j = 2
	lo = []
	while j * j <= i:
		if i % j == 0:
			count = 0
			while i % j == 0:
				count += 1
				i = i // j
			lo.append((j, count))
		j += 1
	if i != 1:
		lo.append((i, 1))
	for k in lo:
		arr[k[0]].append(k[1])
pro = 1
for i in range(po):
	if len(arr[i]) == n:
		arr[i].sort()
		pro = pro * i ** arr[i][1]
	elif len(arr[i]) == n - 1:
		pro = pro * i ** min(arr[i])
print(pro)


t = 1
import math
for t1 in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	z = []
	z.append(l[-1])
	for i in range(n - 2, 0, -1):
		z.append(math.gcd(z[-1], l[i]))
	z = z[::-1]
	ans = []
	for i in range(0, n - 1):
		ans.append(l[i] * z[i] // math.gcd(l[i], z[i]))
	final = ans[0]
	for i in range(1, len(ans)):
		final = math.gcd(final, ans[i])
	print(final)


from collections import defaultdict
import math
n = int(input())
a = list(map(int, input().split()))
suf = [a[-1]]
for i in range(n - 2, -1, -1):
	suf.append(math.gcd(suf[-1], a[i]))
suf = suf[::-1]
ga = []
for i in range(n - 1):
	ga.append(a[i] * suf[i + 1] // math.gcd(a[i], suf[i + 1]))
ans = ga[0]
for i in ga:
	ans = math.gcd(ans, i)
print(ans)


def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
n = int(input())
l = list(map(int, input().split()))
dp = l[:]
for i in range(n - 2, -1, -1):
	dp[i] = gcd(dp[i], dp[i + 1])
ans = l[0] * dp[i + 1] // gcd(l[0], dp[i + 1])
for i in range(1, n - 1):
	ans = gcd(ans, l[i] * dp[i + 1] // gcd(l[i], dp[i + 1]))
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
gcds = [0] * n
gcds[n - 1] = a[n - 1]
for i in range(n - 2, -1, -1):
	gcds[i] = math.gcd(a[i], gcds[i + 1])
b = [0] * n
for i in range(0, n - 1):
	b[i] = a[i] * gcds[i + 1] // gcds[i]
ans = b[0]
for i in range(1, n):
	ans = math.gcd(ans, b[i])
print(ans)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]
spf_sieve()

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
a = int_array()
gcd_arr = [1] * n
gcd_arr[n - 1] = a[n - 1]
_gcd = a[n - 1]
for i in range(n - 2, -1, -1):
	_gcd = gcd(_gcd, a[i])
	gcd_arr[i] = _gcd
to_solve = []
for i in range(n - 1):
	to_solve.append(a[i] * gcd_arr[i + 1] // gcd(a[i], gcd_arr[i + 1]))
ans = to_solve[0]
for i in range(1, len(to_solve)):
	ans = gcd(ans, to_solve[i])
print(ans)


import math

def lcm(a, b):
	return a // math.gcd(a, b) * b
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
pregcd = [0] * n
pregcd[0] = a[0]
for i in range(1, n):
	pregcd[i] = math.gcd(pregcd[i - 1], a[i])
for i in range(1, n):
	ans = math.gcd(ans, lcm(a[i], pregcd[i - 1]))
print(ans)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def factorize(num: int) -> dict:
	from math import sqrt
	from collections import Counter
	d = Counter()
	for i in range(2, int(sqrt(num)) + 1):
		while num % i == 0:
			num //= i
			d[i] += 1
		if num == 1:
			break
	if num != 1:
		d[num] += 1
	return d

def lcm(C1, C2):
	for (k, v) in C2.items():
		C1[k] = max(C1[k], v)
	return C1
N = INT()
A = LIST()
L = Counter()
C = Counter()
for a in A:
	fact = factorize(a)
	L = lcm(L, fact)
	for (k, v) in fact.items():
		C[k, v] += 1
ans = 1
for (k, v) in L.items():
	cnt = 0
	for i in range(v, 0, -1):
		cnt += C[k, i]
		if cnt >= N - 1:
			ans *= k ** i
			break
print(ans)


from math import gcd
n = int(input())
arr = list(map(int, input().split()))
gcds = [0 for i in range(n)]
gcds[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
	gcds[i] = gcd(gcds[i + 1], arr[i])
curr = 0
for i in range(n - 1):
	curr = gcd(curr, arr[i] * gcds[i + 1] // gcd(arr[i], gcds[i + 1]))
print(curr)


t = 1

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

def lcm(a, b):
	return a * b // gcd(a, b)
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	g = a[-1]
	b = []
	for i in range(n - 2, -1, -1):
		b.append(lcm(a[i], g))
		g = gcd(a[i], g)
	g = b[0]
	for i in range(1, len(b)):
		g = gcd(g, b[i])
	print(g)


from math import gcd

def lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
N = int(input())
l = []
s = list(map(int, input().split()))
b = s[-1]
c = []
for i in range(N - 2, -1, -1):
	c.append(b * s[i] // gcd(b, s[i]))
	b = gcd(b, s[i])
b = 0
for i in range(len(c)):
	b = gcd(b, c[i])
print(b)


import sys, os
if 'READ_FILE' in os.environ:
	inp = open('x.in', 'r')
else:
	inp = sys.stdin
m = 200001
n = int(inp.readline())
a = list(map(int, inp.readline().split(' ')))
p = [0] * m
i = 2
while i * i < m:
	if p[i] == 0:
		j = i * i
		while j < m:
			p[j] = i
			j += i
	i += 1
for i in range(m):
	if p[i] == 0:
		p[i] = i

class Div:

	def __init__(self):
		self.used = 0
		self.c1 = 2 ** 31
		self.c2 = 2 ** 31

	def update(self, cnt):
		self.used += 1
		if cnt < self.c1:
			self.c2 = self.c1
			self.c1 = cnt
		elif cnt < self.c2:
			self.c2 = cnt
divs = [Div() for i in range(m)]
for x in a:
	while x != 1:
		d = p[x]
		cnt = 0
		while x % d == 0:
			x = x // d
			cnt += 1
		divs[d].update(cnt)
res = 1
for x in range(len(divs)):
	d = divs[x]
	if d.used == n:
		cnt = d.c2
	elif d.used == n - 1:
		cnt = d.c1
	else:
		continue
	res *= x ** cnt
print(res)


from collections import Counter, defaultdict
n = int(input())
a = list(map(int, input().split()))
eratos = [0 for i in range(500 + 1)]
prime = []
cnt = 2
while True:
	while cnt <= 500 and eratos[cnt]:
		cnt += 1
	if cnt > 500:
		break
	eratos[cnt] = 1
	prime.append(cnt)
	for i in range(cnt ** 2, 500 + 1, cnt):
		eratos[i] = 1

def pb(x):
	ret = []
	while x != 1:
		for i in prime:
			if i > int(x ** 0.5) + 1:
				ret.append(x)
				x //= x
				break
			while x % i == 0:
				ret.append(i)
				x //= i
	return ret
dc = defaultdict(list)
for i in range(n):
	c = Counter(pb(a[i]))
	for (x, v) in c.items():
		dc[x].append(v)
ans = 1
for x in dc:
	if len(dc[x]) == n - 1:
		mn = min(dc[x])
		for i in range(mn):
			ans *= x
	elif len(dc[x]) == n:
		dc[x].sort()
		for i in range(dc[x][1]):
			ans *= x
print(ans)


import math as mt
from collections import defaultdict as dd
import sys
input = sys.stdin.readline
MAXN = 200001
spf = [0 for i in range(MAXN)]

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l += [p]
	return l

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret
n = int(input())
l = list(map(int, input().split()))
sieve()
p = getFactorization(l[0])
p1 = getFactorization(l[1])
p = p + p1
l1 = list(set(p))
d = dd(list)
for i in l1:
	d[i] = [0] * n
c = 0
for x in l:
	for i in l1:
		v = 0
		while x % i == 0:
			v += 1
			x = x // i
		d[i][c] += v
	c += 1
ans = 1
for (i, j) in d.items():
	j.sort()
	ans = ans * i ** j[1]
print(ans)


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

def lcm(x, y):
	return x * y // gcd(x, y)
from collections import defaultdict as d
n = int(input())
arr = [int(x) for x in input().split()]
factorCounts = d(lambda : 0)
for x in arr:
	for f in range(1, int(x ** 0.5) + 1):
		if x % f == 0:
			factorCounts[f] += 1
			if x // f != f:
				factorCounts[x // f] += 1
fC = [(factor, counts) for (factor, counts) in factorCounts.items()]
fC.sort(key=lambda x: x[0])
takenFactors = set()
for (factor, cnts) in fC:
	if cnts >= n - 1:
		for subfactor in range(1, int(factor ** 0.5) + 1):
			if factor % subfactor == 0:
				if subfactor in takenFactors:
					takenFactors.remove(subfactor)
				if factor // subfactor in takenFactors:
					takenFactors.remove(factor // subfactor)
		takenFactors.add(factor)
takenFactors = list(takenFactors)
ans = takenFactors[0]
for i in range(1, len(takenFactors)):
	ans = lcm(ans, takenFactors[i])
print(ans)


from sys import stdin, stdout
from math import *
input = stdin.readline
n = int(input())
ar = list(map(int, input().split()))
g = [0] * n
t = 0
for i in range(n - 1, -1, -1):
	g[i] = gcd(t, ar[i])
	t = g[i]
temp = []
for i in range(n - 1):
	temp.append(ar[i] * g[i + 1])
gg = 0
for i in range(len(temp)):
	gg = gcd(temp[i], gg)
g2 = 0
for i in range(n):
	g2 = gcd(g2, ar[i])
print(gg // g2)


import sys
from math import gcd
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
cg = [0] * N
cg[-1] = a[-1]
for i in range(N - 2, -1, -1):
	cg[i] = gcd(cg[i + 1], a[i])
res = 1
lcg = 0
for i in range(N):
	t = lcg + 0
	if i + 1 < N:
		t = gcd(t, cg[i + 1])
	res = res * t // gcd(res, t)
	lcg = gcd(lcg, a[i])
print(res)


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	revgcd = []
	x = 0
	for i in range(n):
		revgcd.append(gcd(x, a[n - i - 1]))
		x = gcd(x, a[n - i - 1])
	revgcd = revgcd[::-1]
	l = []
	for i in range(n - 1):
		fi = revgcd[i + 1]
		se = a[i]
		lcm = fi * se // gcd(fi, se)
		l.append(lcm)
	x = 0
	for i in l:
		x = gcd(i, x)
	print(x)