from collections import * def div(n): if n <= 0: return [] S = set() i = 1 while i * i <= n: if n % i == 0: S.add(i) S.add(n // i) i += 1 return list(S) N = int(input()) A = list(map(int, input().split())) D = defaultdict(int) for a in A: D[a] += 1 M = 1010101 L = [0] * M for k, v in D.items(): for j in div(k): L[j] += v for i in range(M-2, -1, -1): L[i] = max(L[i], L[i + 1]) now = 1 for i in range(N): while L[now] + i >= N and L[now + 1] + i >= N: now += 1 print(now)