n = int(input()) A = list(map(int, input().split())) cnt = [0 for _ in range(max(A) + 1)] for i in range(n): f = 1 while f * f <= A[i]: if A[i] % f == 0: cnt[f] += 1 cnt[A[i] // f] += 1 f += 1 ans = [0 for _ in range(n)] for i in range(1, max(A) + 1): num = n - cnt[i] if num == n: continue ans[num] = max(ans[num], i) for i in range(n): if i > 0: ans[i] = max(ans[i], ans[i - 1]) print(ans[i])