#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int co[1000010] = {}, a[200020]; int d[200020] = {}; int ans[200020] = {}; int main() { int n; cin >> n; int m = 0; for (int i = 0; i < n; i++) { cin >> a[i]; m = max(m, a[i]); } for (int i = 2; i <= m; i++) { if (d[i] == 0) { for (int j = i; j <= m; j += i) { if (d[j] == 0) { d[j] = i; } } } } set st, st1; for (int i = 0; i < n; i++) { int now = a[i]; while (now != 1) { for (auto j = st.begin(); j != st.end(); j++) { st1.insert(*j * d[now]); } st1.insert(d[now]); for (auto j = st1.begin(); j != st1.end(); j++) { st.insert(*j); } now = now / d[now]; } for (auto j = st.begin(); j != st.end(); j++) { co[*j]++; } st.clear(); st1.clear(); } for (int i = 2; i <= m; i++) { ans[min(n, co[i])] = i; } ans[n + 1] = 1; for (int i = n; i > 0; i--) { ans[i] = max(ans[i], ans[i + 1]); cout << ans[i] << endl; } }