#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c> n; vvl G = VV(n, 0, 0, ll); vll idx(1000001, -1); vll a(n); get(a); sort(all(a)); re(i, n) idx[a[i]] = i; re(i, n){ for(ll j=2*a[i];j<=1000000;j+=a[i]){ if(i>=idx[j]) continue; G[i].push_back(idx[j]); } } vll dist(n, 1); ll ans = 0; for(int i=0;i