from collections import defaultdict N = int(input()) A = list(map(int, input().split())) M = 10**6 # M=20 K = 20 fact = [1]*(M+1) isprime = [] for i in range(2, M+1): if fact[i] > 1: continue isprime.append(i) for j in range(i*2, M+1, i): if fact[j] == 1: fact[j] = j//i count = {p: [0]*(K+1) for p in isprime} for i, a in enumerate(A): f = defaultdict(int) while a > 1: q = a//fact[a] f[q] += 1 a = fact[a] for p in f: count[p][f[p]] |= 1 << i for p in count: for i in range(K, 0, -1): count[p][i-1] |= count[p][i] count[p][0] = (1 << N)-1 ans = [0]*(N+1) ans[0] = 1 for i in range(2, M+1): f = defaultdict(int) a = i while a > 1: q = a//fact[a] f[q] += 1 a = fact[a] ct = (1 << N)-1 for p in f: ct &= count[p][f[p]] c = str(bin(ct)).count('1') ans[N-c] = i for i in range(N-1): ans[i+1] = max(ans[i], ans[i+1]) print(*ans[:-1], sep='\n')