#include using namespace std; int a[100005], dp[100005]; int main(){ int n; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } int maxx = INT_MIN; for(int i = 1; i <= n; i++){ for(int j = 1; j * j <= a[i]; j++){ if(a[i] % j == 0){ if(j * j != a[i]){ dp[a[i]] = max({dp[a[i]], dp[j] + 1, dp[a[i] / j] + 1}); } else{ dp[a[i]] = max(dp[a[i]], dp[j] + 1); } } } maxx = max(maxx, dp[a[i]]); } cout << maxx << '\n'; return 0; }