n = int(input()) inf = 10 ** 6 + 1 l = [inf] * (10 ** 6+1) a = list(map(int,input().split())) from collections import defaultdict for i in range(2,int((10 ** 6) ** ( 1/2)) + 1): if l[i] == inf: j = i * 2 cnt = 2 while j <= 10 ** 6: l[j] = min(i,l[j]) cnt += 1 j = i * cnt from collections import defaultdict def fast_prime_factorization(w): d = defaultdict(int) while w > 1: div = l[w] if div == inf: d[w] += 1 break while w % div == 0: d[div] += 1 w //= div return d from itertools import product d2 = defaultdict(int) for i in range(n): d = fast_prime_factorization(a[i]) ll = [[] for _ in range(len(d))] for cnt,j in enumerate(d.keys()): for k in range(d[j]+1): ll[cnt].append(j**k) for pro in product(*ll): res = 1 for pp in pro: res *= pp # print(res) d2[res] += 1 d3 = defaultdict(int) for k in d2.keys(): d3[d2[k]] = max(d3[d2[k]],k) for i in range(n): if (n-i) in d3: ans = d3[n-i] print(ans)