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