#include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) #define INF 2000000007 #define MINF -200000007 #define MOD 1048576 // 2^20 #define MAX 1000005 typedef unsigned int uint; typedef unsigned long long int ull; typedef long long int ll; int dp[MAX]; int main(){ int N;cin>>N; vector A(N); cout << N << endl; REP(i,N)cin>>A[i]; int upper = A[N-1]; cout << " " << endl; sort(A.begin(),A.end()); cout << "sorted" << endl; fill(dp,dp+upper+1,MINF); cout << "max : " << upper << endl; int maxl = 0; REP(i,N){ int X = A[i]; if(dp[X] < 0) dp[X]=1; for(int j=i-1;j>=0;--j){ int Y = A[j]; if (X%Y != 0) continue; //cout << X << ":" << Y << "[" << dp[Y] << "]" << endl; dp[X] = max(dp[X],dp[Y]+1); } } REP(i,N) maxl = max(maxl,dp[A[i]]); cout << maxl << endl; return 0; }