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