#include using namespace std; const int MAXN = 1e5 + 10; long long n, a[MAXN], dp[MAXN], ans; int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } for(int i = 1; i <= n; i++){ // dp[a[i]] = 1; for(long long j = 1; j * j <= a[i]; j++){ if(!(a[i] % j)){ dp[a[i]] = max({dp[a[i]], dp[j] + 1, dp[a[i] / j] + 1}); } } ans = max(dp[a[i]], ans); } cout << ans; return 0; }