#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) using mint = atcoder::modint998244353; template void chmin(T &a,T b){ if(a>b) a=b; } int main(){ int n; cin>>n; vector a(n); rep(i,n) cin>>a.at(i); map> mp; rep(i,n){ int tmp=a.at(i); for(ll j=2;j*j<=tmp;j++){ if(tmp%j==0){ mp[j].push_back(i); while(tmp%j==0) tmp/=j; } } if(tmp>1) mp[tmp].push_back(i); } atcoder::dsu uf(n); for(auto&[x,v]:mp){ for(auto&y:v){ uf.merge(v.at(0),y); } } vector sc(n,1e18); for(auto&[x,v]:mp){ for(auto&y:v){ chmin(sc.at(uf.leader(y)),x); } } ll mn=1e18; set st; rep(i,n){ st.insert(uf.leader(i)); chmin(mn,sc.at(uf.leader(i))); } cout<