N = int(input()) x = [int(i) for i in input().split()] M = max(x) + 1 dp = [0] * M ans = 0 for i in range(N): dp[x[i]] = 1 for i in range(M): if dp[i] == 0: continue for j in range(i + i,M,i): if dp[j] == 0: continue dp[j] = max(dp[j],dp[i] + 1) ans = max(ans,dp[i]) print (ans)