#include using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} struct union_find { public: explicit union_find() {} explicit union_find(int N) : n(N), par(N, -1), siz(N, 1) {} int find(int x) { assert(0 <= x && x < n); if (par[x] == -1) return x; par[x] = find(par[x]); return par[x]; } int same(int x, int y) { assert(0 <= x && x < n); assert(0 <= y && y < n); return find(x) == find(y); } int size(int x) { assert(0 <= x && x < n); return siz[find(x)]; } bool unite(int x, int y) { assert(0 <= x && x < n); assert(0 <= y && y < n); x = find(x); y = find(y); if (x == y) return false; if (siz[x] < siz[y]) std::swap(x, y); siz[x] += siz[y]; par[y] = x; return true; } private: int n; std::vector par, siz; }; const int M=200'000; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vectorA(N); for(int i=0;i>A[i]; union_find uf(N); vectorP; vectoris_prime(M+1,true); is_prime[1]=false; for(int p=2;p<=M;p++){ if(!is_prime[p])continue; P.push_back(p); for(int i=2*p;i<=M;i+=p){ is_prime[i]=false; } } for(auto p:P){ vectorv; for(int i=0;i